Code

Ticket #7252: inheritance_manager_fix.diff

File inheritance_manager_fix.diff, 553 bytes (added by floguy, 6 years ago)
Line 
1diff --git a/django/db/models/manager.py b/django/db/models/manager.py
2index 3a9da34..2e83ad2 100644
3--- a/django/db/models/manager.py
4+++ b/django/db/models/manager.py
5@@ -138,6 +138,8 @@ class ManagerDescriptor(object):
6     def __get__(self, instance, type=None):
7         if instance != None:
8             raise AttributeError, "Manager isn't accessible via %s instances" % type.__name__
9+        if type is not None and self.manager.model != type:
10+            self.manager.model = type
11         return self.manager
12 
13 class EmptyManager(Manager):