-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add '.basename' and '.reverse_action()' to ViewSet #5648
Conversation
OK. Good: I was going to look at #5605 so breaking it up is a win. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass I'd be happy to see this go in as is.
Anyone else want to review?
Bit agnostic on this - I'll leave it to you fellas. |
For context, supporting #5605 would at least require the router to provide the
|
* Router sets 'basename' on ViewSet * Add 'ViewSet.reverse_action()' method * Test router setting initkwargs
Just breaking out a portion of #5605.
Description
ViewSet
s cannot effectively reverse their action URLs, as they aren't aware of thebasename
they were registered to the router with. This value can be hardcoded in the view class, however this is problematic when theViewSet
is registered with a differentbasename
.basename
with the viewset'sinitkwargs
..reverse_action()
convenience method to viewsets.