Fixed #22720 -- Migrations attempt to create _order twice.

This commit is contained in:
Víðir Valberg Guðmundsson 2014-05-29 01:00:30 +02:00
parent 7e3cf3cfd2
commit 6cfa2fae39
1 changed files with 2 additions and 1 deletions

View File

@ -167,6 +167,7 @@ class Options(object):
if self.order_with_respect_to: if self.order_with_respect_to:
self.order_with_respect_to = self.get_field(self.order_with_respect_to) self.order_with_respect_to = self.get_field(self.order_with_respect_to)
self.ordering = ('_order',) self.ordering = ('_order',)
if not any(isinstance(field, OrderWrt) for field in model._meta.local_fields):
model.add_to_class('_order', OrderWrt()) model.add_to_class('_order', OrderWrt())
else: else:
self.order_with_respect_to = None self.order_with_respect_to = None