djangorestframework-stubs
djangorestframework-stubs copied to clipboard
Fields named as Serializer properties throws assignment error
If a serializer has a field named the same as DRF's Serializer class properties; data, errors and fields, an assignment error will be thrown.
I'm having the same issue but with a field named label
Code:
class RiskFieldSerializer(serializers.Serializer):
id = serializers.CharField()
label = serializers.CharField()
status = serializers.CharField()
Error message:
Incompatible types in assignment (expression has type "CharField", base class "Field" defined the type as "Optional[str]")
just ran into this with a field named label, glad this issue is open or i never would have solved it