Skip to content

Commit 703655b

Browse files
committed
Non model Viewset requires base_name when registering to router.
1 parent 8ee706a commit 703655b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/api-guide/viewsets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Typically we wouldn't do this, but would instead register the viewset with a rou
5151
from rest_framework.routers import DefaultRouter
5252

5353
router = DefaultRouter()
54-
router.register(r'users', UserViewSet)
54+
router.register(r'users', UserViewSet, base_name='user')
5555
urlpatterns = router.urls
5656

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

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