diff --git a/django/db/models/base.py b/django/db/models/base.py
index 05cd0d9..3a3fbf1 100644
a
|
b
|
class ModelBase(type):
|
116 | 116 | new_class._meta.local_many_to_many): |
117 | 117 | raise FieldError("Proxy model '%s' contains model fields." |
118 | 118 | % name) |
| 119 | while base._meta.proxy: |
| 120 | base = base._meta.proxy_for_model |
119 | 121 | new_class._meta.setup_proxy(base) |
120 | 122 | |
121 | 123 | # Do the appropriate setup for any model parents. |
… |
… |
class ModelBase(type):
|
123 | 125 | if isinstance(f, OneToOneField)]) |
124 | 126 | |
125 | 127 | for base in parents: |
| 128 | original_base = base |
126 | 129 | if not hasattr(base, '_meta'): |
127 | 130 | # Things without _meta aren't functional models, so they're |
128 | 131 | # uninteresting parents. |
… |
… |
class ModelBase(type):
|
167 | 170 | # Proxy models inherit the non-abstract managers from their base, |
168 | 171 | # unless they have redefined any of them. |
169 | 172 | if is_proxy: |
170 | | new_class.copy_managers(base._meta.concrete_managers) |
| 173 | new_class.copy_managers(original_base._meta.concrete_managers) |
171 | 174 | |
172 | 175 | # Inherit virtual fields (like GenericForeignKey) from the parent |
173 | 176 | # class |
diff --git a/django/db/models/manager.py b/django/db/models/manager.py
index 57844f2..52612d8 100644
a
|
b
|
class Manager(object):
|
57 | 57 | setattr(model, name, ManagerDescriptor(self)) |
58 | 58 | if not getattr(model, '_default_manager', None) or self.creation_counter < model._default_manager.creation_counter: |
59 | 59 | model._default_manager = self |
60 | | if model._meta.abstract or self._inherited: |
| 60 | if model._meta.abstract or (self._inherited and not self.model._meta.proxy): |
61 | 61 | model._meta.abstract_managers.append((self.creation_counter, name, |
62 | 62 | self)) |
63 | 63 | else: |
diff --git a/tests/modeltests/proxy_models/models.py b/tests/modeltests/proxy_models/models.py
index ab38112..f0ee626 100644
a
|
b
|
class MyPersonProxy(MyPerson):
|
82 | 82 | class LowerStatusPerson(MyPersonProxy): |
83 | 83 | status = models.CharField(max_length=80) |
84 | 84 | |
| 85 | class User(models.Model): |
| 86 | name = models.CharField(max_length=100) |
| 87 | |
| 88 | def __unicode__(self): |
| 89 | return self.name |
| 90 | |
| 91 | class UserProxy(User): |
| 92 | class Meta: |
| 93 | proxy = True |
| 94 | |
| 95 | class UserProxyProxy(UserProxy): |
| 96 | class Meta: |
| 97 | proxy = True |
| 98 | |
85 | 99 | __test__ = {'API_TESTS' : """ |
86 | 100 | # The MyPerson model should be generating the same database queries as the |
87 | 101 | # Person model (when the same manager is used in each case). |
… |
… |
FieldError: Proxy model 'NoNewFields' contains model fields.
|
178 | 192 | >>> ctype = ContentType.objects.get_for_model |
179 | 193 | >>> ctype(Person) is ctype(OtherPerson) |
180 | 194 | True |
181 | | """} |
182 | 195 | |
| 196 | >>> MyPersonProxy.objects.all() |
| 197 | [<MyPersonProxy: barney>, <MyPersonProxy: fred>] |
183 | 198 | |
| 199 | >>> u = User.objects.create(name='Bruce') |
| 200 | >>> User.objects.all() |
| 201 | [<User: Bruce>] |
| 202 | >>> UserProxy.objects.all() |
| 203 | [<UserProxy: Bruce>] |
| 204 | >>> UserProxyProxy.objects.all() |
| 205 | [<UserProxyProxy: Bruce>] |
| 206 | """} |