You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following (simplified) django and django-polymorphic models:
class GenericOffer(PolymorphicModel):
pass
class OfferA(GenericOffer):
special = models.IntegerField()
class OfferB(GenericOffer):
pass
class GenericProduct(PolymorphicModel):
offer = models.ForeignKey(to=GenericOffer)
class ProductA(GenericProduct):
pass
class ProductB(GenericProduct):
pass
class Gizmo(models.Model):
product = models.ForeignKey(to=GenericProduct)
I have the following (simplified)
django
anddjango-polymorphic
models:from which I can create the following instances:
Now, I have:
But:
That is, the foreign key linked to a foreign key of my
Gizmo
is not automatically cast to its proper type.Is it the expected behavior?
Should I use a
GenericRelation
instead of aForeignKey
in myGizmo
to make sure I can easily access thespecial
field of myoffer
ongizmo_a
?The text was updated successfully, but these errors were encountered: