[Fixed]-Django REST Framework API to update database

1👍

Considering you only need to perform update operation you can inherit your views from UpdateAPIView.

Here is your views.py file:

class CricketTeamView(UpdateAPIView):
    def get_queryset(self):
        return CricketTeam.objects.all()

Here is your serializers.py file:

class CricketTeamSerializer(serializers.Serializer):

    class Meta:
        model = CricketTeam
        fields = ('dateCreated', 'captain', 'coach', 'physician')

For detailed help you can visit Django Rest Framework’s documentation

Leave a comment