mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #29556 -- Made 'remove_stale_contenttypes --noinput' delete content types.
This commit is contained in:
parent
178624855a
commit
08ebed5e79
@ -60,7 +60,7 @@ Are you sure you want to delete these content types?
|
||||
If you're unsure, answer 'no'.\n""" % content_type_display)
|
||||
ok_to_delete = input("Type 'yes' to continue, or 'no' to cancel: ")
|
||||
else:
|
||||
ok_to_delete = False
|
||||
ok_to_delete = 'yes'
|
||||
|
||||
if ok_to_delete == 'yes':
|
||||
for ct in to_remove:
|
||||
|
@ -52,14 +52,11 @@ class RemoveStaleContentTypesTests(TestCase):
|
||||
self.assertEqual(ContentType.objects.count(), self.before_count)
|
||||
|
||||
def test_interactive_false(self):
|
||||
"""
|
||||
non-interactive mode of remove_stale_contenttypes doesn't delete
|
||||
stale content types.
|
||||
"""
|
||||
"""non-interactive mode deletes stale content types."""
|
||||
with captured_stdout() as stdout:
|
||||
call_command('remove_stale_contenttypes', interactive=False, verbosity=2)
|
||||
self.assertIn("Stale content types remain.", stdout.getvalue())
|
||||
self.assertEqual(ContentType.objects.count(), self.before_count + 1)
|
||||
self.assertIn('Deleting stale content type', stdout.getvalue())
|
||||
self.assertEqual(ContentType.objects.count(), self.before_count)
|
||||
|
||||
def test_unavailable_content_type_model(self):
|
||||
"""A ContentType isn't created if the model isn't available."""
|
||||
|
Loading…
Reference in New Issue
Block a user