class ViewSetMixin: (source)
Known subclasses: rest_framework.viewsets.GenericViewSet
, rest_framework.viewsets.ViewSet
This is the magic. Overrides `.as_view()` so that it takes an `actions` keyword that performs the binding of HTTP methods to actions on the Resource. For example, to create a concrete view binding the 'GET' and 'POST' methods to the 'list' and 'create' actions... view = MyViewSet.as_view({'get': 'list', 'post': 'create'})
Class Method | get |
Get the methods that are marked as an extra ViewSet `@action`. |
Method | as |
Because of the way class based views create a closure around the instantiated view, we need to totally reimplement `.as_view`, and slightly modify the view function that is created and returned. |
Method | get |
Build a map of {names: urls} for the extra actions. |
Method | initialize |
Set the `.action` attribute on the view, depending on the request method. |
Method | reverse |
Reverse the action for the given `url_name`. |
Instance Variable | action |
Undocumented |
Because of the way class based views create a closure around the instantiated view, we need to totally reimplement `.as_view`, and slightly modify the view function that is created and returned.
Build a map of {names: urls} for the extra actions. This method will noop if `detail` was not provided as a view initkwarg.