Fixed #22470: Full migration support for order_with_respect_to

This commit is contained in:
Andrew Godwin 2014-06-15 14:55:44 -07:00
parent a58f49d104
commit a8ce5fdc28
8 changed files with 234 additions and 3 deletions

View file

@ -367,6 +367,37 @@ class StateTests(TestCase):
1,
)
def test_ignore_order_wrt(self):
"""
Makes sure ProjectState doesn't include OrderWrt fields when
making from existing models.
"""
new_apps = Apps()
class Author(models.Model):
name = models.TextField()
class Meta:
app_label = "migrations"
apps = new_apps
class Book(models.Model):
author = models.ForeignKey(Author)
class Meta:
app_label = "migrations"
apps = new_apps
order_with_respect_to = "author"
# Make a valid ProjectState and render it
project_state = ProjectState()
project_state.add_model_state(ModelState.from_model(Author))
project_state.add_model_state(ModelState.from_model(Book))
self.assertEqual(
[name for name, field in project_state.models["migrations", "book"].fields],
["id", "author"],
)
class ModelStateTests(TestCase):
def test_custom_model_base(self):