summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAndriy Sokolovskiy <me@asokolovskiy.com>2015-06-18 13:33:36 +0300
committerTim Graham <timograham@gmail.com>2015-06-29 21:15:37 -0400
commitc0cf73a57d7f77af348aeb854e7b4f670dc3cee7 (patch)
treec67e49a7e164dda1376dc9fa75111e1db06d8911 /django
parent1d40204f820aea019bc76a56d314b4a09560a756 (diff)
Refs #20203 -- Allowed adding custom default manager to the model state
If the only manager on the model is the default manager defined by Django (`objects = models.Manager()`), this manager will not be added to the model state. If it is custom, it needs to be passed to the model state.
Diffstat (limited to 'django')
-rw-r--r--django/db/migrations/state.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py
index 33362ed06f..c865f139d7 100644
--- a/django/db/migrations/state.py
+++ b/django/db/migrations/state.py
@@ -465,7 +465,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())]:
+ # If the only manager on the model is the default manager defined
+ # by Django (`objects = models.Manager()`), this manager will not
+ # be added to the model state.
+ if managers == [('objects', models.Manager())]:
managers = []
else:
managers = []