diff options
| author | Víðir Valberg Guðmundsson <valberg@orn.li> | 2014-05-29 01:00:30 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-05-29 07:52:17 -0400 |
| commit | 0ee27d5b62a76781f5d78fc3f506dca624941062 (patch) | |
| tree | 067b2cf6aa0110b90c703884b81f506915e0a587 | |
| parent | b8b1fbd4c1c42d3cf84d67c1923716842025680b (diff) | |
[1.7.x] Fixed #22720 -- Migrations attempt to create _order twice.
Backport of 6cfa2fae39 from master
| -rw-r--r-- | django/db/models/options.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/options.py b/django/db/models/options.py index d204bcf84c..c49567d795 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -179,7 +179,8 @@ class Options(object): 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 |
