You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# urls.pyurlpatterns= [
# permission will be addedpath('test_urlpattern/', TestViewSet.as_view({'get': 'test_action'}, permission_classes=[IsAuthenticated, ])),
]
According to the docs, it's not clear this feature works for Router configuration only. No exceptions, warnings, or even related github issues were found regarding this.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
isn't .as_view only work for class based views only? do we need this in viewsets?
If your question is whether the drf needs .as_view() in view sets, I believe yes, at least because lots of users' code may rely on it. My suggestion is to add some sort of validation or warning on passing arguments to .as_view(), since if you try to reroute GET requests to a specific function (action) the requests would just be passed to the default get() handler no matter what you configured before.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I encountered a problem when overriding viewset-level attributes doesn't work for actions if a route is configured as
.as_view()
.Example:
You can override it using
initkwargs
onlyAccording to the docs, it's not clear this feature works for Router configuration only. No exceptions, warnings, or even related github issues were found regarding this.
The text was updated successfully, but these errors were encountered: