You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-guide/viewsets.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -127,7 +127,7 @@ You may inspect these attributes to adjust behaviour based on the current action
127
127
128
128
## Marking extra actions for routing
129
129
130
-
If you have ad-hoc methods that should be routable, you can mark them as such with the `@action` decorator. Like regular actions, extra actions may be intended for either a list of objects, or a single instance. To indicate this, set the `detail` argument to `True` or `False`. The router will configure its URL patterns accordingly. e.g., the `DefaultRouter` will configure detail actions to contain `pk` in their URL patterns.
130
+
If you have ad-hoc methods that should be routable, you can mark them as such with the `@action` decorator. Like regular actions, extra actions may be intended for either a single object, or an entire collection. To indicate this, set the `detail` argument to `True` or `False`. The router will configure its URL patterns accordingly. e.g., the `DefaultRouter` will configure detail actions to contain `pk` in their URL patterns.
131
131
132
132
A more complete example of extra actions:
133
133
@@ -174,7 +174,7 @@ The decorator can additionally take extra arguments that will be set for the rou
174
174
def set_password(self, request, pk=None):
175
175
...
176
176
177
-
These decorator will route `GET` requests by default, but may also accept other HTTP methods by setting the `methods` argument. For example:
177
+
The `action` decorator will route `GET` requests by default, but may also accept other HTTP methods by setting the `methods` argument. For example:
178
178
179
179
@action(detail=True, methods=['post', 'delete'])
180
180
def unset_password(self, request, pk=None):
@@ -186,7 +186,7 @@ To view all extra actions, call the `.get_extra_actions()` method.
186
186
187
187
### Routing additional HTTP methods for extra actions
188
188
189
-
Extra actions can be mapped to different`ViewSet` methods. For example, the above password set/unset methods could be consolidated into a single route. Note that additional mappings do not accept arguments.
189
+
Extra actions can map additional HTTP methods to separate`ViewSet` methods. For example, the above password set/unset methods could be consolidated into a single route. Note that additional mappings do not accept arguments.
0 commit comments