|
@@ -4,22 +4,6 @@ from __future__ import unicode_literals
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
|
|
|
-def assert_foo_contenttype_not_cached(apps, schema_editor):
|
|
|
- ContentType = apps.get_model('contenttypes', 'ContentType')
|
|
|
- try:
|
|
|
- content_type = ContentType.objects.get_by_natural_key('contenttypes_tests', 'foo')
|
|
|
- except ContentType.DoesNotExist:
|
|
|
- pass
|
|
|
- else:
|
|
|
- if not ContentType.objects.filter(app_label='contenttypes_tests', model='foo').exists():
|
|
|
- raise AssertionError('The contenttypes_tests.Foo ContentType should not be cached.')
|
|
|
- elif content_type.model != 'foo':
|
|
|
- raise AssertionError(
|
|
|
- "The cached contenttypes_tests.Foo ContentType should have "
|
|
|
- "its model set to 'foo'."
|
|
|
- )
|
|
|
-
|
|
|
-
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
operations = [
|
|
@@ -29,6 +13,4 @@ class Migration(migrations.Migration):
|
|
|
('id', models.AutoField(primary_key=True)),
|
|
|
],
|
|
|
),
|
|
|
- migrations.RenameModel('Foo', 'RenamedFoo'),
|
|
|
- migrations.RunPython(assert_foo_contenttype_not_cached, migrations.RunPython.noop)
|
|
|
]
|