aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/compat.py
diff options
context:
space:
mode:
authorAndrew Hankinson2012-12-16 13:11:59 -0500
committerAndrew Hankinson2012-12-16 13:11:59 -0500
commit4f96951be9800cfc1fc67795a26d11ac66abc60d (patch)
tree06240c788fa81fefe73c88b5acbaa9599af3f48c /rest_framework/compat.py
parent35f72cecb199e1790a42fadd6037da43cdd5a05a (diff)
downloaddjango-rest-framework-4f96951be9800cfc1fc67795a26d11ac66abc60d.tar.bz2
Add 'patch' http method support to the Django View object
Diffstat (limited to 'rest_framework/compat.py')
-rw-r--r--rest_framework/compat.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index d4901437..5996b16e 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -90,6 +90,12 @@ else:
update_wrapper(view, cls.dispatch, assigned=())
return view
+# Taken from @markotibold's attempt at supporting PATCH.
+# https://github.com/markotibold/django-rest-framework/tree/patch
+http_method_names = set(View.http_method_names)
+http_method_names.add('patch')
+View.http_method_names = list(http_method_names) # PATCH method is not implemented by Django
+
# PUT, DELETE do not require CSRF until 1.4. They should. Make it better.
if django.VERSION >= (1, 4):
from django.middleware.csrf import CsrfViewMiddleware