djangorestframework-types icon indicating copy to clipboard operation
djangorestframework-types copied to clipboard

serializer.instance is of type Any

Open andresespinosapc opened this issue 11 months ago • 1 comments

The type of serializer.instance and the return type of serializer.save() are Any. I saw in djangorestframework-stubs that I had to create the class like this:

class MyModelSerializer(serializers.ModelSerializer[MyModel]):
    class Meta:
        model = MyModel
        fields = ("id", "example")

but it doesn't work either.

andresespinosapc avatar Apr 05 '25 14:04 andresespinosapc

related: https://github.com/typeddjango/djangorestframework-stubs/issues/71

Sinkler avatar Jun 12 '25 11:06 Sinkler

I think this is covered under #46, but I agree this would be very helpful to have

BHSPitMonkey avatar Jan 21 '26 19:01 BHSPitMonkey