Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Joseph Kocherhans authored February 10, 2010
2  django/db/models/base.py
@@ -683,7 +683,7 @@ def _get_unique_checks(self, exclude=None):
683 683
                 if name in exclude:
684 684
                     break
685 685
             else:
686  
-                unique_checks.append(check)
  686
+                unique_checks.append(tuple(check))
687 687
 
688 688
         # These are checks for the unique_for_<date/year/month>.
689 689
         date_checks = []
2  tests/modeltests/validation/models.py
@@ -36,7 +36,7 @@ class UniqueTogetherModel(models.Model):
36 36
     efield = models.EmailField()
37 37
 
38 38
     class Meta:
39  
-        unique_together = (('ifield', 'cfield',), ('ifield', 'efield'))
  39
+        unique_together = (('ifield', 'cfield',), ['ifield', 'efield'])
40 40
 
41 41
 class UniqueForDateModel(models.Model):
42 42
     start_date = models.DateField()
2  tests/modeltests/validation/test_unique.py
@@ -13,7 +13,7 @@ def test_unique_fields_get_collected(self):
13 13
             m._get_unique_checks()
14 14
         )
15 15
 
16  
-    def test_unique_together_gets_picked_up(self):
  16
+    def test_unique_together_gets_picked_up_and_converted_to_tuple(self):
17 17
         m = UniqueTogetherModel()
18 18
         self.assertEqual(
19 19
             ([('ifield', 'cfield',),('ifield', 'efield'), ('id',), ], []),

0 notes on commit 225c413

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