aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/views.py
diff options
context:
space:
mode:
authorOscar Vilaplana2013-05-19 15:45:33 +0200
committerOscar Vilaplana2013-05-19 15:45:33 +0200
commit7a5cd090aa91a5d1af0d54586f36e2156e1ccc60 (patch)
tree0e24aa9070eeeb578bb076eba02391f4c80a3d9a /rest_framework/views.py
parent6bbedfd7ae25655d94281764cb375fc7c2d0c13a (diff)
downloaddjango-rest-framework-7a5cd090aa91a5d1af0d54586f36e2156e1ccc60.tar.bz2
fixed tests, added docs, renamed helper method
Diffstat (limited to 'rest_framework/views.py')
-rw-r--r--rest_framework/views.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/rest_framework/views.py b/rest_framework/views.py
index 1c4854f0..5f9e1bf2 100644
--- a/rest_framework/views.py
+++ b/rest_framework/views.py
@@ -61,15 +61,16 @@ class APIView(View):
'renders': [renderer.media_type for renderer in self.renderer_classes],
'parses': [parser.media_type for parser in self.parser_classes],
}
- action_metadata = self._generate_action_metadata(request)
- if action_metadata is not None:
- content['actions'] = action_metadata
+ content['actions'] = self.action_metadata(request)
return content
- def _generate_action_metadata(self, request):
- """
- Helper for generating the fields metadata for allowed and permitted methods.
+ def action_metadata(self, request):
+ """Return a dictionary with the fields required fo reach allowed method. If no method is allowed,
+ return an empty dictionary.
+
+ :param request: Request for which to return the metadata of the allowed methods.
+ :return: A dictionary of the form {method: {field: {field attribute: value}}}
"""
actions = {}
for method in self.allowed_methods: