Monday, February 24, 2014

Using request.DELETE in django

If you want to access QueryDict parameters, when using request.method == 'DELETE' you can't access it via request.DELETE as when you use GET or POST.

Instead you should create that Dict yourself:

from django.http import QueryDict
def my_delete_api(request):
if request.method == 'DELETE':
data = QueryDict(request.body)
                key = data.get('key', None)

No comments:

Post a Comment