Open sam-ghosh opened 3 years ago
Did you make any progress on this? I'm also running into this problem.
No real solution I'm just using Basemodel.objects.get(id=id)
Why is no one responding to this issue
I think this scenario is the reason that there's a get_real_instance
method on PolymorphicModel
. The manager for Foo
is ordinary Django, so an extra query has to be incurred, here.
If the code in question can predict what the polymorphic_ctype
will be ahead of time, the extra query could potentially be avoided.
I am using django-polymorphic
I have a
And I use them as
later when I want to access
i want to get foo.fk as the Child object, but I instead get the Base object. I have to do :
Child.objects.get(id=foo.fk.id)
Is there a way to get the attribute accessor
foo.fk
resolve to Child class directly?