mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
Add 'head' to viewset actions map
This commit is contained in:
parent
87f5b42db7
commit
b58b344edc
|
@ -93,6 +93,10 @@ class ViewSetMixin:
|
|||
|
||||
def view(request, *args, **kwargs):
|
||||
self = cls(**initkwargs)
|
||||
|
||||
if 'get' in actions and 'head' not in actions:
|
||||
actions['head'] = actions['get']
|
||||
|
||||
# We also store the mapping of request methods to actions,
|
||||
# so that we can later set the action attribute.
|
||||
# eg. `self.action = 'list'` on an incoming GET request.
|
||||
|
@ -104,9 +108,6 @@ class ViewSetMixin:
|
|||
handler = getattr(self, action)
|
||||
setattr(self, method, handler)
|
||||
|
||||
if hasattr(self, 'get') and not hasattr(self, 'head'):
|
||||
self.head = self.get
|
||||
|
||||
self.request = request
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
|
Loading…
Reference in New Issue
Block a user