Fixed #22183: Through M2Ms now correctly handled

This commit is contained in:
Andrew Godwin 2014-03-08 15:57:25 -08:00
parent cdf6eba181
commit 6b07804474
5 changed files with 44 additions and 3 deletions

View file

@ -242,6 +242,12 @@ class FieldDeconstructionTests(TestCase):
self.assertEqual(args, [])
self.assertEqual(kwargs, {"to": "auth.User"})
self.assertEqual(kwargs['to'].setting_name, "AUTH_USER_MODEL")
# Test through
field = models.ManyToManyField("auth.Permission", through="auth.Group")
name, path, args, kwargs = field.deconstruct()
self.assertEqual(path, "django.db.models.ManyToManyField")
self.assertEqual(args, [])
self.assertEqual(kwargs, {"to": "auth.Permission", "through": "auth.Group"})
@override_settings(AUTH_USER_MODEL="auth.Permission")
def test_many_to_many_field_swapped(self):