If you are creating a simple REST API, you are not going to have a good time unless you are working with a framework.
Wouldn't it be nice if you could use request.PUT just like the dicts request.POST and request.GET After finally searching online, I have stumbled upon a way to do just that.
You can find the code on BitBucket.
if request.method == "PUT":
if hasattr(request, '_post'):
del request._post
del request._files
try:
request.method = "POST"
request._load_post_and_files()
request.method = "PUT"
except AttributeError:
request.META['REQUEST_METHOD'] = 'POST'
request._load_post_and_files()
request.META['REQUEST_METHOD'] = 'PUT'
request.PUT = request.POST
What you do here is simply change the request method back to POST, reload the variables and rename the request method and request.POST dictionary. A nice hack to get your job done.