Skip to content

Commit 199e5a9

Browse files
Add warning for .as_view() with @action. Fixes #9638
1 parent 577bb3c commit 199e5a9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/api-guide/viewsets.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Typically we wouldn't do this, but would instead register the viewset with a rou
5757
router.register(r'users', UserViewSet, basename='user')
5858
urlpatterns = router.urls
5959

60+
> **Warning**: Do not use `.as_view()` with `@action` methods. It bypasses router setup and may ignore action settings like `permission_classes`. Use `DefaultRouter` for actions.
61+
6062
Rather than writing your own viewsets, you'll often want to use the existing base classes that provide a default set of behavior. For example:
6163

6264
class UserViewSet(viewsets.ModelViewSet):

0 commit comments

Comments
 (0)