Skip to content

Commit cfc067b

Browse files
Add warning regarding .as_view() with ViewSet action in the documentation (#9823)
1 parent af32103 commit cfc067b

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)