-
-
Notifications
You must be signed in to change notification settings - Fork 303
Closed
Description
I wonder if you might want to document this alternative when using values()? Even though this isn't really django-polymorphic specific, I think you're the one adding in the ctype.
In this example, we have A->B->C and A->D->E
E has a column 'foo', and C has a column 'bar'.
This works by joining in the model name from the ctype. Then also joining in the specific attributes of the inherited models ...
A.objects.values('polymorphic_ctype__model', 'b__c__foo', 'd__e__bar')
One could look at the model string returned instead of isinstance and then select which fields to look at in the code. The irrelevant ones end up being None.
...maybe this is obvious, but it was kind of an Aha! moment for me when trying to convert some queries to values().
neoden
Metadata
Metadata
Assignees
Labels
No labels