@classmethod
    def many_init(cls, *args, **kwargs):
        child_serializer = cls(*args, **kwargs)
        # use dedicated model serializer for each possible descendant class
        # and pass it to list serializer
        child_serializers = {}
        for descendant_model in cls.Meta.model._polymorphic_descendants:
            child_serializers[descendant_model] = cls._serializers_registry.get(
                descendant_model, cls
            )(*args, **kwargs)
        list_kwargs = {
            'child': child_serializer,
            'child_serializers': child_serializers,
        }
        list_kwargs.update(dict([
            (key, value) for key, value in kwargs.items()
            if key in serializers.LIST_SERIALIZER_KWARGS
        ]))
        return PolymorphicListSerializer(*args, **list_kwargs)
dataset/ETHPy150Open allegro/ralph/src/ralph/api/utils.py/PolymorphicSerializer.many_init/original