aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/compat.py
diff options
context:
space:
mode:
authormarkotibold2011-06-25 17:31:04 +0200
committermarkotibold2011-06-25 17:31:04 +0200
commit209ee829031ff69ddfe275ee0e41c173f5dec2f4 (patch)
treefc347393d7567217cef459fbf863c2ad6962d414 /djangorestframework/compat.py
parentbae21b14c93e458014107a007e894e93a181bd0e (diff)
parentd3024ff18150e41190da76592d948b724727ca74 (diff)
downloaddjango-rest-framework-209ee829031ff69ddfe275ee0e41c173f5dec2f4.tar.bz2
Merge with 4b1ee62051cce8fa9b83ac740d7262ad4a55494b
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..827b4adf 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/15668
+ 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