Ticket #5460: unique_together_single_tuple.diff
File unique_together_single_tuple.diff, 1.4 KB (added by , 17 years ago) |
---|
-
django/db/models/options.py
52 52 del meta_attrs['__doc__'] 53 53 for attr_name in DEFAULT_NAMES: 54 54 setattr(self, attr_name, meta_attrs.pop(attr_name, getattr(self, attr_name))) 55 # Normalize unique_together to a tuple of tuples 56 ut = meta_attrs.pop('unique_together', getattr(self, 'unique_together')) 57 if ut and not isinstance(ut[0], tuple): 58 ut = (ut,) 59 setattr(self, 'unique_together', ut) 55 60 # verbose_name_plural is a special case because it uses a 's' 56 61 # by default. 57 62 setattr(self, 'verbose_name_plural', meta_attrs.pop('verbose_name_plural', string_concat(self.verbose_name, 's'))) -
docs/model-api.txt
1224 1224 level (i.e., the appropriate ``UNIQUE`` statements are included in the 1225 1225 ``CREATE TABLE`` statement). 1226 1226 1227 **New in Django development version** 1228 1229 For convenience, unique_together can be a single list when dealing 1230 with a single set of fields:: 1231 1232 unique_together = ("driver", "restaurant") 1233 1227 1234 ``verbose_name`` 1228 1235 ---------------- 1229 1236