-
Notifications
You must be signed in to change notification settings - Fork 161
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
Change the URL parameter names? #130
Comments
If you look in the source, the nested router classes include some info on the
Basically there will always be two strings separated by an underscore (see routers.py line 53) In your case the Viewset's |
The question is how do you fix i.e. change this!? |
Hi @matthewsheeran. I think that your question is similar to the one on #270, yet idk if is a duplicate. Hope this to helps to understand how and why things are as they are today, yet any change proposal will be very welcome from my side 👍 Best regards. |
Yeah i tried changing things in the NestedMixin etc code but only succeeeded breaking things as you cautioned. I then looked at only modifying the Swagger UI from drf-spectacular - which was the real issue - along the lines of tfranzel/drf-spectacular#516 . Not exaclty per this post but something similar for drf-yasg with their respective SchemaGenerator and OpenAPISchemaGenerator being customized which sounds more promising for my purposes.. Ah here it is: #180 |
I suspect this is a silly question that I could answer myself if I could find the right parts of the docs. So sorry in advance about that.
I want to have my URLs be more explicit about the path params. This is mostly for people reading the auto generated swagger docs.
I'd like my URLs to look like this:
The closest I can get is:
I get this far by setting the lookup field in my NodeViewSet to 'node_id', in DiskViewSet it's 'disk_id'.
My router then looks like this:
How can I get rid of that pesky 'node_' prefix? Thanks!
The text was updated successfully, but these errors were encountered: