diff options
| author | Nikolaus Schlemm | 2013-05-19 14:58:11 +0200 |
|---|---|---|
| committer | Nikolaus Schlemm | 2013-05-19 14:58:11 +0200 |
| commit | 88c94f372049058a7a982745e8b772bd057abe99 (patch) | |
| tree | e2bb485ff106968f20c97bbef75e7cfe2f95ec36 /rest_framework/views.py | |
| parent | efca5f6feccf72421577ccea8889c7de729c47b8 (diff) | |
| parent | f1f5f92d899ae37d71234bf8a8a3ad52e20a253f (diff) | |
| download | django-rest-framework-88c94f372049058a7a982745e8b772bd057abe99.tar.bz2 | |
Merge remote-tracking branch 'grimborg/issue-192-expose-fields-for-options' into issue-192-expose-fields-for-options
Diffstat (limited to 'rest_framework/views.py')
| -rw-r--r-- | rest_framework/views.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/rest_framework/views.py b/rest_framework/views.py index be64a8d0..1c4854f0 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -2,13 +2,16 @@ Provides an APIView class that is the base of all views in REST framework. """ from __future__ import unicode_literals + from django.core.exceptions import PermissionDenied from django.http import Http404, HttpResponse from django.views.decorators.csrf import csrf_exempt + from rest_framework import status, exceptions from rest_framework.compat import View -from rest_framework.response import Response +from rest_framework.fields import humanize_form_fields from rest_framework.request import clone_request, Request +from rest_framework.response import Response from rest_framework.settings import api_settings from rest_framework.utils.formatting import get_view_name, get_view_description @@ -69,7 +72,6 @@ class APIView(View): Helper for generating the fields metadata for allowed and permitted methods. """ actions = {} - for method in self.allowed_methods: # skip HEAD and OPTIONS if method in ('HEAD', 'OPTIONS'): @@ -84,17 +86,11 @@ class APIView(View): actions[method] = {} continue - # TODO: find right placement - APIView does not have get_serializer if not hasattr(self, 'get_serializer'): continue serializer = self.get_serializer() if serializer is not None: - field_name_types = {} - for name, field in serializer.fields.iteritems(): - from rest_framework.fields import humanize_field - field_name_types[name] = humanize_field(field) - - actions[method] = field_name_types + actions[method] = humanize_form_fields(serializer) except exceptions.PermissionDenied: # don't add this method pass |
