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

Fixed #23101 db_table wasn't copied in deconstruct

Forward port of 999758fc7a from
stable/1.7.x
This commit is contained in:
Abraham Martin
2014-07-26 18:48:36 +02:00
committed by Andrew Godwin
parent 805774df1f
commit e1347e9253
2 changed files with 8 additions and 0 deletions

View File

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