[Fixed]-Django rest unsuccessful request from client

1๐Ÿ‘

โœ…

My guess is that the problem is that you are creating a serializer incorrectly. You are specifically indicating to use __all__ fields which means all fields. Not relevant to this, but you should not really need a create or update on a Model serielizer.

Instead, try something like this

class ExhibitionSurveyObjectSerializer(serializers.ModelSerializer):
    class Meta:
        model = ExhibitionSurveyObject
        fields = ('name', 'farmer_email', 'farmer_name', 'address', 
                  'postal_code', 'size', 'path', 'object_type', 
                  'cycle')
        read_only_fields = ('owner', )

That should be all you need.

Leave a comment