diff options
Diffstat (limited to 'djangorestframework/compat.py')
| -rw-r--r-- | djangorestframework/compat.py | 12 |
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 |
