Skip to content

Commit 205f09e

Browse files
author
Ryan P Kilby
committed
Router sets 'detail' on ViewSet
1 parent 05ac150 commit 205f09e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

rest_framework/routers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ def get_urls(self):
296296
initkwargs = route.initkwargs.copy()
297297
initkwargs.update({
298298
'basename': basename,
299+
'detail': route.detail,
299300
})
300301

301302
view = viewset.as_view(mapping, **initkwargs)

rest_framework/viewsets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ def as_view(cls, actions=None, **initkwargs):
5252
# eg. 'List' or 'Instance'.
5353
cls.suffix = None
5454

55+
# The detail initkwarg is reserved for introspecting the viewset type.
56+
cls.detail = None
57+
5558
# Setting a basename allows a view to reverse its action urls. This
5659
# value is provided by the router through the initkwargs.
5760
cls.basename = None

0 commit comments

Comments
 (0)