diff options
| author | Tom Christie | 2014-09-10 16:57:22 +0100 | 
|---|---|---|
| committer | Tom Christie | 2014-09-10 16:57:22 +0100 | 
| commit | 80ba0473473501968154c5cc5dd5922e53d96a70 (patch) | |
| tree | 40e766f9f2149a5f9052465ff22ad07b161ae905 /rest_framework/compat.py | |
| parent | 01c8c0cad977fc0787dbfc78bd34f4fd37e613f4 (diff) | |
| download | django-rest-framework-80ba0473473501968154c5cc5dd5922e53d96a70.tar.bz2 | |
Compat fixes
Diffstat (limited to 'rest_framework/compat.py')
| -rw-r--r-- | rest_framework/compat.py | 12 | 
1 files changed, 11 insertions, 1 deletions
| diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 70b38df9..7c05bed9 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -110,8 +110,18 @@ def get_concrete_model(model_cls):          return model_cls +# View._allowed_methods only present from 1.5 onwards +if django.VERSION >= (1, 5): +    from django.views.generic import View +else: +    from django.views.generic import View as DjangoView + +    class View(DjangoView): +        def _allowed_methods(self): +            return [m.upper() for m in self.http_method_names if hasattr(self, m)] + +  # PATCH method is not implemented by Django -from django.views.generic import View  if 'patch' not in View.http_method_names:      View.http_method_names = View.http_method_names + ['patch'] | 
