diff options
| author | Max Arnold | 2012-07-12 23:12:09 +0700 |
|---|---|---|
| committer | Max Arnold | 2012-07-12 23:12:09 +0700 |
| commit | fe262ef3537fa67ecda374825a295ff854f027a3 (patch) | |
| tree | 3419bbaf0ddbb4b21fe012ead0811b7db8dba9ec /djangorestframework/compat.py | |
| parent | 36686cad13e7483699f224b16c9b7722c969f355 (diff) | |
| download | django-rest-framework-fe262ef3537fa67ecda374825a295ff854f027a3.tar.bz2 | |
patch View.head() only for django < 1.4
Diffstat (limited to 'djangorestframework/compat.py')
| -rw-r--r-- | djangorestframework/compat.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/djangorestframework/compat.py b/djangorestframework/compat.py index 11f24b86..b5858a82 100644 --- a/djangorestframework/compat.py +++ b/djangorestframework/compat.py @@ -65,13 +65,14 @@ except ImportError: environ.update(request) return WSGIRequest(environ) -# django.views.generic.View (Django >= 1.3) +# django.views.generic.View (1.3 <= Django < 1.4) try: from django.views.generic import View - from django.utils.decorators import classonlymethod - from django.utils.functional import update_wrapper - if not hasattr(View, 'head'): + if django.VERSION < (1, 4): + from django.utils.decorators import classonlymethod + from django.utils.functional import update_wrapper + # 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): |
