diff options
| author | Òscar Vilaplana | 2013-05-19 01:59:19 -0700 |
|---|---|---|
| committer | Òscar Vilaplana | 2013-05-19 01:59:19 -0700 |
| commit | 42b61ffcd7dd5091846d884cba34f3a82dcf81f4 (patch) | |
| tree | b33a515f024a93051424318b2c6d1a291fee5198 /rest_framework/views.py | |
| parent | fecadacab150aab48b8b84f4f0e5340ead74c287 (diff) | |
| parent | c0f3a1c397a564ee78b3a656f14f7ff46b0d2b31 (diff) | |
| download | django-rest-framework-42b61ffcd7dd5091846d884cba34f3a82dcf81f4.tar.bz2 | |
Merge pull request #1 from nschlemm/issue-192-expose-fields-for-options
Merged work in progress for Issue 192 expose fields for options
Diffstat (limited to 'rest_framework/views.py')
| -rw-r--r-- | rest_framework/views.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/rest_framework/views.py b/rest_framework/views.py index c4662a1f..e8bd9f50 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -71,6 +71,10 @@ class APIView(View): actions = {} for method in self.allowed_methods: + # skip HEAD and OPTIONS + if method in ('HEAD', 'OPTIONS'): + continue + cloned_request = clone_request(request, method) try: self.check_permissions(cloned_request) @@ -81,11 +85,13 @@ class APIView(View): field_name_types = {} for name, field in serializer.fields.iteritems(): from rest_framework.fields import humanize_field - humanize_field(field) - field_name_types[name] = field.__class__.__name__ + field_name_types[name] = humanize_field(field) actions[method] = field_name_types - except: + except exceptions.PermissionDenied: + # don't add this method + pass + except exceptions.NotAuthenticated: # don't add this method pass |
