'django-filter fieldset dependent on related field polymorphic ctype

class RelatedPoly(PolymorphicModel):
  common_field = ...


class QweRelatedPoly(RelatedPoly):
  qwe = ...


class RtyRelatedPoly(RelatedPoly):
  rty = ...


class A(Model):
  related_poly = OneToOneField(RelatedPoly, ...)

I also have a ViewSet for A model, and I need to implement a filterset_class which should be able to filter by both qwe and rty fields of RelatedPoly subclasses. In which ways could I achieve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source