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
If I have a URL path such as: /api/users/{username}
When I nest this with some child element, I get the the lookup value given toNestedSimpleRouter prepended: routers.NestedSimpleRouter(router, api_path_users, lookup="username")
/api/users/{username_username}/books/
Is there a way to not have this prepend happen? I've tried working with parent_lookup_kwargs and so on, but to no avail. Any ideas how to make it so the url would be /api/users/{username}/books/?
Thanks!
The text was updated successfully, but these errors were encountered:
If I have a URL path such as: /api/users/{username}
When I nest this with some child element, I get the the lookup value given toNestedSimpleRouter prepended: routers.NestedSimpleRouter(router, api_path_users, lookup="username")
/api/users/{username_username}/books/
Is there a way to not have this prepend happen? I've tried working with parent_lookup_kwargs and so on, but to no avail. Any ideas how to make it so the url would be /api/users/{username}/books/?
Thanks!
Hi,
I think there is no such possibility.
lookup parameter in the NestedSimpleRouter ensures that every URL kwarg will be unique.
So if you have many lookups named 'slug' you will end up with 'username_slug' and 'book_slug'.
I guess it would be better to have a lookups named 'name' or 'slug' for username as 'username' is an instance and 'name' or 'slug' could be his lookups.
Then 'username_name' or 'username_slug' would be much more readable.
If I have a URL path such as:
/api/users/{username}
When I nest this with some child element, I get the the
lookup
value given toNestedSimpleRouter
prepended:routers.NestedSimpleRouter(router, api_path_users, lookup="username")
/api/users/{username_username}/books/
Is there a way to not have this prepend happen? I've tried working with
parent_lookup_kwargs
and so on, but to no avail. Any ideas how to make it so the url would be/api/users/{username}/books/
?Thanks!
The text was updated successfully, but these errors were encountered: