Skip to content

Commit

Permalink
Fixed #22720 -- Migrations attempt to create _order twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
valberg committed May 28, 2014
1 parent 7e3cf3c commit 6cfa2fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django/db/models/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def _prepare(self, model):
if self.order_with_respect_to:
self.order_with_respect_to = self.get_field(self.order_with_respect_to)
self.ordering = ('_order',)
model.add_to_class('_order', OrderWrt())
if not any(isinstance(field, OrderWrt) for field in model._meta.local_fields):
model.add_to_class('_order', OrderWrt())
else:
self.order_with_respect_to = None

Expand Down

0 comments on commit 6cfa2fa

Please sign in to comment.