Reputation: 110432
Where does django store the PUT
and DELETE
request information. Is this in POST
or something?
if not (request.POST.get(required_arg) or request.GET.get(required_arg) or request.DELETE.get(required_arg)):
'WSGIRequest' object has no attribute 'DELETE'
Upvotes: 2
Views: 5101
Reputation: 153
You can get PUT/DELETE request data by using QuerySet.
from django.http import QueryDict
delete_queryset = QueryDict(request.body)
description = delete_queryset.get('description')
Upvotes: 0
Reputation: 197
Because most web browsers don't actually support PUT
, DELETE
, or PATCH
, Django (as well as other frameworks) simulates those with a POST
.
If you don't actually know which method the parameter you want will use you could use request.REQUEST.get(required_arg)
which checks the POST
variables first and then GET
. The Django docs discourage this in favor of explicitly request.GET
or request.POST
for most circumstances.
See https://docs.djangoproject.com/en/1.7/ref/request-response/
Upvotes: 2