Skip to content

Commit a294a45

Browse files
committed
Update documentation to mention HTTPMethod support in @action
1 parent 47d3873 commit a294a45

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/api-guide/viewsets.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ The `action` decorator will route `GET` requests by default, but may also accept
178178
def unset_password(self, request, pk=None):
179179
...
180180

181+
Argument `methods` also supports HTTP methods defined as [HTTPMethod](https://docs.python.org/3/library/http.html#http.HTTPMethod). Example below is identical to the one above:
182+
183+
from http import HTTPMethod
184+
185+
@action(detail=True, methods=[HTTPMethod.POST, HTTPMethod.DELETE])
186+
def unset_password(self, request, pk=None):
187+
...
181188

182189
The decorator allows you to override any viewset-level configuration such as `permission_classes`, `serializer_class`, `filter_backends`...:
183190

0 commit comments

Comments
 (0)