Custom actions (detail=False) not included in API root by DefaultRouter #8397
Unanswered
astro-stan
asked this question in
Potential Issue
Replies: 1 comment
-
I can confirm this behavior, but I'm not sure whether it was intended or not. Well actually, after having some thought, I think it's somewhat intended. API root will return all of your viewsets' root URLs (if it exists). Let's take a look at both versions of your viewset:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Folder structure:
In
app/api/views.py
consider the following viewset:In
app/api/urls.py
:In
project/urls.py
:Now, when I go to the
api/v1
endpoint I get:However, If I change
MyViewSet
to the following:And then visit the
api/v1
endbpoint:It looks like the
@action
decorator does not cause the action to be added to the root API view, even if it is a list action (detail=False).Beta Was this translation helpful? Give feedback.
All reactions