Commit 538ffaf6 by Tom Christie

Store self.action='metadata' for OPTIONS requests on viewsets. Closes #3115.

parent 11e3cfbf
...@@ -83,6 +83,12 @@ class ViewSetMixin(object): ...@@ -83,6 +83,12 @@ class ViewSetMixin(object):
if hasattr(self, 'get') and not hasattr(self, 'head'): if hasattr(self, 'get') and not hasattr(self, 'head'):
self.head = self.get self.head = self.get
# Explicitly map `options` requests to an (implicit) action named
# 'metadata'. This action doesn't actually exist as a named method,
# because, unlike other methods, we always route to it.
if hasattr(self, 'options'):
self.action_map['options'] = 'metadata'
# And continue as usual # And continue as usual
return self.dispatch(request, *args, **kwargs) return self.dispatch(request, *args, **kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment