aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/compat.py
diff options
context:
space:
mode:
authorTom Christie2011-06-25 14:53:48 +0100
committerTom Christie2011-06-25 14:53:48 +0100
commitd3557bdcd0f4d6a7106267ea0f8a3024f21fd9f9 (patch)
tree05c49fa0f7d78721cad77656e1952553380420ac /djangorestframework/compat.py
parent50efa106529e03eda5607e6c9323838432ce755f (diff)
parent0626b618ad0d3c5f8fbb6ab3facce440647fb3c0 (diff)
downloaddjango-rest-framework-d3557bdcd0f4d6a7106267ea0f8a3024f21fd9f9.tar.bz2
Allow HEAD method
Diffstat (limited to 'djangorestframework/compat.py')
-rw-r--r--djangorestframework/compat.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/djangorestframework/compat.py b/djangorestframework/compat.py
index 0274511a..f09b7cc3 100644
--- a/djangorestframework/compat.py
+++ b/djangorestframework/compat.py
@@ -67,6 +67,14 @@ except ImportError:
# django.views.generic.View (Django >= 1.3)
try:
from django.views.generic import View
+ if not hasattr(View, 'head'):
+ # First implementation of Django class-based views did not include head method
+ # in base View class - https://code.djangoproject.com/ticket/15688
+ class ViewPlusHead(View):
+ def head(self, request, *args, **kwargs):
+ return self.get(request, *args, **kwargs)
+ View = ViewPlusHead
+
except ImportError:
from django import http
from django.utils.functional import update_wrapper
@@ -145,6 +153,8 @@ except ImportError:
#)
return http.HttpResponseNotAllowed(allowed_methods)
+ def head(self, request, *args, **kwargs):
+ return self.get(request, *args, **kwargs)
try:
import markdown
@@ -193,4 +203,4 @@ try:
return md.convert(text)
except ImportError:
- apply_markdown = None \ No newline at end of file
+ apply_markdown = None