So I am making a view in Django, and I'm trying to use POST for creation, GET for fetching, I wanted to use PATCH for handling updations, but I am struggling to understand how to process an incoming PATCH request's data.
I am sending a PATCH request in POSTMAN, with form-data(key-value pairs), but when trying to access the data, request.POST
or request.PATCH
or request.data
dont work. Only thing that works is request.body
which is a byte string that I have to decode and I don't want to do something like that just to access the data, is there a better way to do this?
My question is, what is the right way to make a PATCH view and how to handle the data from an incoming request? Handling POST data seems so straightforward by doing request.POST, why is PATCH not as straightforward? What do i do? Should I not be using PATCH then? Is it better to use POST for updation as well?