Reputation: 1744
I've a project that need integration with PUT and DELETE method recently. However it has being quite large for me to refactory it using Django Restful Project. How can I get PUT and DELETE method, and its data like POST simply?
Is there a quick middleware for it?
Thx in advance.
Upvotes: 1
Views: 857
Reputation: 309099
You can see how Django constructs the POST
data from request.body
in the source code. You should be be able to do something similar.
Assuming the PUT data is form encoded:
from django.http.request import QueryDict
def my_put_view(request):
if request.method = 'PUT':
PUT = QueryDict(self.body, encoding=request._encoding), MultiValueDict()
# do something with PUT
Upvotes: 1
Reputation: 1307
Have a read here, I think this might be what you are looking for.
You can use the so called POST TUNNELLING method, that is using a POST request, putting the HTTP header X_METHODOVERRIDE in the request.
Upvotes: 1