Created
August 8, 2011 17:06
-
-
Save khamidou/1132206 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert_overloaded_post(request): | |
""" | |
Convert a POST method with a hidden field | |
named _method to a PUT or a DELETE | |
""" | |
request._load_post_and_files() | |
if request.method == "POST": | |
if hasattr(request.POST, "_method"): | |
if request.POST["_method"] == "PUT": | |
request.method = "PUT" | |
request.PUT = request.POST | |
elif request.POST["_method"] == "DELETE": | |
request.method = "DELETE" | |
return request |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment