I have django rest framework and with generics views. Whenever I try to make a PATCH request, I get an error that method not allowed.
Below is my views.py code
class VisitorsLogBooktbViewSet(generics.ListCreateAPIView):
queryset = VisitorsLogBooktb.objects.all()
serializer_class = VisitorsLogBooktbSerializer
class Visitor_data(generics.RetrieveUpdateDestroyAPIView):
queryset = models.VisitorsLogBooktb.objects.all()
serializer_class = VisitorsLogBooktbSerializer
and below is my urls.py code in the app root
urlpatterns = [
path('', VisitorsLogBooktbViewSet.as_view(),),
path('api/All-visitors/', Visitor_data.as_view(),),
]
I have tried changing the generics views by creating views only for updates using just generics.UpdateAPIView……But it still doesn’t work.