Created
June 17, 2015 21:52
-
-
Save MarkusH/f1b46a6d43eac06234f1 to your computer and use it in GitHub Desktop.
managers in migrations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py | |
index b1cba07..1fdd9f6 100644 | |
--- a/django/db/migrations/state.py | |
+++ b/django/db/migrations/state.py | |
@@ -467,7 +467,10 @@ class ModelState(object): | |
(name, instance) for name, (cc, instance) in | |
sorted(managers_mapping.items(), key=lambda v: v[1]) | |
] | |
- if managers == [(default_manager_name, models.Manager())]: | |
+ # In case the only manager on the model is the default manager | |
+ # defined by Django (objects = models.Manager()) migrations won't | |
+ # add that manager to the model state. | |
+ if managers == [('objects', models.Manager())]: | |
managers = [] | |
else: | |
managers = [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment