From 2a52785815300019b8436032ab73494d60ab269d Mon Sep 17 00:00:00 2001 From: 0Nafi0 <128926697+0Nafi0@users.noreply.github.com> Date: Wed, 31 Dec 2025 20:21:54 +0600 Subject: [PATCH] Update viewsets documentation with trailing slash warning Added warning about trailing slashes in viewset prefixes. --- docs/api-guide/viewsets.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md index 142cbcabf..09eb7fd39 100644 --- a/docs/api-guide/viewsets.md +++ b/docs/api-guide/viewsets.md @@ -59,6 +59,8 @@ Typically we wouldn't do this, but would instead register the viewset with a rou !!! 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. +!!! warning + When registering viewsets, do not include a trailing slash in the prefix (e.g., use `r'users'`, not `r'users/'`). Unlike standard Django URL patterns, DRF routers append slashes automatically based on your trailing slash configuration. 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: