Reputation: 1477
I am having a strange issue here with django 1.6.5.
from core.models import Book, Person
class Proxy1(Book):
class Meta:
proxy = True
class Proxy2(Person):
class Meta:
proxy = True
>>> from distribution.models import Proxy1, Proxy2
>>> type(Proxy1.objects.first())
<class 'core.models.Book'>
>>> type(Proxy2.objects.first())
<class 'distribution.models.Proxy2'>
Any ideas where to hunt for the cause?
Upvotes: 3
Views: 568
Reputation: 1477
After a lot of hours hunting I finally found the culprit. The MoneyField from the django-money package does some dark magic on the model manager that somehow breaks returning the correct model class for proxy models. I filed an issue: https://github.com/jakewins/django-money/issues/80
I settled with an easy workaround by manually overriding the 'objects' attribute on the proxy class like this:
class ProxyModel(SomeModelWithMoneyField):
# This fixes django-money that would else return parent objects
objects = models.Manager()
class Meta:
proxy=True
Upvotes: 2