Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #12647. Allow unique_together checks be specified as lists as w…

…ell as tuples. Thanks, Honza Král.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12403 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 225c413b08b3e034604ffbaed604a6867d7b712e 1 parent 8f4540b
@jkocherhans jkocherhans authored
View
2  django/db/models/base.py
@@ -683,7 +683,7 @@ def _get_unique_checks(self, exclude=None):
if name in exclude:
break
else:
- unique_checks.append(check)
+ unique_checks.append(tuple(check))
# These are checks for the unique_for_<date/year/month>.
date_checks = []
View
2  tests/modeltests/validation/models.py
@@ -36,7 +36,7 @@ class UniqueTogetherModel(models.Model):
efield = models.EmailField()
class Meta:
- unique_together = (('ifield', 'cfield',), ('ifield', 'efield'))
+ unique_together = (('ifield', 'cfield',), ['ifield', 'efield'])
class UniqueForDateModel(models.Model):
start_date = models.DateField()
View
2  tests/modeltests/validation/test_unique.py
@@ -13,7 +13,7 @@ def test_unique_fields_get_collected(self):
m._get_unique_checks()
)
- def test_unique_together_gets_picked_up(self):
+ def test_unique_together_gets_picked_up_and_converted_to_tuple(self):
m = UniqueTogetherModel()
self.assertEqual(
([('ifield', 'cfield',),('ifield', 'efield'), ('id',), ], []),

0 comments on commit 225c413

Please sign in to comment.
Something went wrong with that request. Please try again.