-
-
Notifications
You must be signed in to change notification settings - Fork 303
Closed
Description
I'm sorry if this has been asked before, or has been documented somewhere, but I can't seem to find a way to do the following...
Say we have a NormalModel, which has a foreign key to a PolymorphicModel with children PolymorphicA and PolymorphicB. Is there a way to query NormalModel, based on the type of the polymorphic relation?
I would imagine something like NormalModel.objects.filter(Q(polymorphic_model___instance_of=PolymorphicA)), but since NormalModel has a normal manager, ___instance_of does not work. I could maybe hack around it with NormalModel.objects.filter(polymorphic_model__polymorphic_ctype_id=X) where I predetermine X, but I don't think that's how I should be doing things.
Metadata
Metadata
Assignees
Labels
No labels