Fixed #24479 -- Added system check to prevent both ordering and order_wrt.

This commit is contained in:
Jon Dufresne 2015-03-17 07:42:53 -07:00 committed by Tim Graham
parent e304e13448
commit 966a29c2b8
5 changed files with 64 additions and 4 deletions

View file

@ -100,6 +100,7 @@ class Options(object):
self.verbose_name_plural = None
self.db_table = ''
self.ordering = []
self._ordering_clash = False
self.unique_together = []
self.index_together = []
self.select_on_save = False
@ -234,6 +235,9 @@ class Options(object):
if self.verbose_name_plural is None:
self.verbose_name_plural = string_concat(self.verbose_name, 's')
# order_with_respect_and ordering are mutually exclusive.
self._ordering_clash = bool(self.ordering and self.order_with_respect_to)
# Any leftover attributes must be invalid.
if meta_attrs != {}:
raise TypeError("'class Meta' got invalid attribute(s): %s" % ','.join(meta_attrs.keys()))