def get_queryset(self):
        queryset = super().get_queryset()
        polymorphic_select_related = {}
        for model, view in self._viewsets_registry.items():
            if model in queryset.model._polymorphic_descendants:
                polymorphic_select_related[model._meta.object_name] = (
                    view.select_related
                )
        return queryset.polymorphic_select_related(**polymorphic_select_related)
dataset/ETHPy150Open allegro/ralph/src/ralph/api/utils.py/PolymorphicViewSetMixin.get_queryset/original