drf-dynamic-fields icon indicating copy to clipboard operation
drf-dynamic-fields copied to clipboard

field selection not working with SerializerMethodField

Open roberto-ayala opened this issue 2 years ago • 0 comments

class ServiceSerializer(DynamicFieldsMixin, serializers.ModelSerializer):

    stretch = serializers.SerializerMethodField()

    class Meta:
        model = Service
        fields = ['id', 'stretch', 'name']

    def get_stretch(self, obj):
         ...

I can't skip the stretch field or select the others, it always shows me all the fields, is there any way to do it?

roberto-ayala avatar Jan 30 '23 14:01 roberto-ayala