Changeset 6213
- Timestamp:
- 09/14/07 15:36:53 (1 year ago)
- Files:
-
- django/trunk/django/db/models/options.py (modified) (1 diff)
- django/trunk/docs/model-api.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/models/options.py
r6195 r6213 53 53 for attr_name in DEFAULT_NAMES: 54 54 setattr(self, attr_name, meta_attrs.pop(attr_name, getattr(self, attr_name))) 55 56 # unique_together can be either a tuple of tuples, or a single 57 # tuple of two strings. Normalize it to a tuple of tuples, so that 58 # calling code can uniformly expect that. 59 ut = meta_attrs.pop('unique_together', getattr(self, 'unique_together')) 60 if ut and not isinstance(ut[0], (tuple, list)): 61 ut = (ut,) 62 setattr(self, 'unique_together', ut) 63 55 64 # verbose_name_plural is a special case because it uses a 's' 56 65 # by default. 57 66 setattr(self, 'verbose_name_plural', meta_attrs.pop('verbose_name_plural', string_concat(self.verbose_name, 's'))) 67 58 68 # Any leftover attributes must be invalid. 59 69 if meta_attrs != {}: django/trunk/docs/model-api.txt
r6205 r6213 1226 1226 level (i.e., the appropriate ``UNIQUE`` statements are included in the 1227 1227 ``CREATE TABLE`` statement). 1228 1229 **New in Django development version** 1230 1231 For convenience, unique_together can be a single list when dealing 1232 with a single set of fields:: 1233 1234 unique_together = ("driver", "restaurant") 1228 1235 1229 1236 ``verbose_name``
