1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #21010 -- Changed ModelState to only copy _meta.local_fields.

This commit is contained in:
Loic Bistuer
2013-09-01 04:18:44 +07:00
committed by Tim Graham
parent 533d1ab334
commit 34d52fd32e
2 changed files with 20 additions and 1 deletions

View File

@@ -75,3 +75,22 @@ class StateTests(TestCase):
new_app_cache = project_state.render()
self.assertEqual(new_app_cache.get_model("migrations", "Tag")._meta.get_field_by_name("name")[0].max_length, 100)
self.assertEqual(new_app_cache.get_model("migrations", "Tag")._meta.get_field_by_name("hidden")[0].null, False)
def test_render_multiple_inheritance(self):
# Use a custom app cache to avoid polluting the global one.
new_app_cache = BaseAppCache()
class Book(models.Model):
title = models.CharField(max_length=1000)
class Meta:
app_label = "migrations"
app_cache = new_app_cache
class Novel(Book):
class Meta:
app_label = "migrations"
app_cache = new_app_cache
yet_another_app_cache = BaseAppCache()
ModelState.from_model(Novel).render(yet_another_app_cache)