Skip to content

Commit ca03600

Browse files
rpkilbycarltongibson
authored andcommitted
Adjust 'extra action' docs
1 parent 492a92d commit ca03600

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/api-guide/viewsets.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ You may inspect these attributes to adjust behaviour based on the current action
127127

128128
## Marking extra actions for routing
129129

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.
131131

132132
A more complete example of extra actions:
133133

@@ -174,7 +174,7 @@ The decorator can additionally take extra arguments that will be set for the rou
174174
def set_password(self, request, pk=None):
175175
...
176176

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:
178178

179179
@action(detail=True, methods=['post', 'delete'])
180180
def unset_password(self, request, pk=None):
@@ -186,7 +186,7 @@ To view all extra actions, call the `.get_extra_actions()` method.
186186

187187
### Routing additional HTTP methods for extra actions
188188

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.
190190

191191
```python
192192
@action(detail=True, methods=['put'], name='Change Password')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy