Renamed variables after generalization of constraints.

Follow up to 8eae094638.
This commit is contained in:
Paveł Tyślacki 2019-01-10 22:06:17 +03:00 committed by Tim Graham
parent cf1fe22009
commit 647be06538
2 changed files with 3 additions and 3 deletions

View File

@ -292,7 +292,7 @@ class BaseDatabaseSchemaEditor:
for fields in model._meta.unique_together:
columns = [model._meta.get_field(field).column for field in fields]
self.deferred_sql.append(self._create_unique_sql(model, columns))
constraints = [check.constraint_sql(model, self) for check in model._meta.constraints]
constraints = [constraint.constraint_sql(model, self) for constraint in model._meta.constraints]
# Make the table
sql = self.sql_create_table % {
"table": self.quote_name(model._meta.db_table),

View File

@ -80,8 +80,8 @@ class UniqueConstraintTests(TestCase):
def test_deconstruction(self):
fields = ['foo', 'bar']
name = 'unique_fields'
check = models.UniqueConstraint(fields=fields, name=name)
path, args, kwargs = check.deconstruct()
constraint = models.UniqueConstraint(fields=fields, name=name)
path, args, kwargs = constraint.deconstruct()
self.assertEqual(path, 'django.db.models.UniqueConstraint')
self.assertEqual(args, ())
self.assertEqual(kwargs, {'fields': tuple(fields), 'name': name})