Skip to content
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

Nested router breaks DefaultRouter index page #14

Closed
chibisov opened this issue Jun 22, 2014 · 2 comments
Closed

Nested router breaks DefaultRouter index page #14

chibisov opened this issue Jun 22, 2014 · 2 comments
Labels

Comments

@chibisov
Copy link
Owner

DefaultRouter tries to reverse nested routes and breaks with error:

Reverse for 'action-categories-action-list' with arguments '()' and keyword arguments '{}' not found.
@kevin-brown
Copy link
Contributor

This is an issue I tried to tackle a while back and have not yet found a good way to get around it. Right now, in my current implementation of this, we are just hiding nested urls (expecting that users will link to them in other places).

https://github.com/kevin-brown/drf-nested-viewsets/blob/a9642a8f9c0e866a542fa5f8d6747dc02ee05997/rest_nested_viewsets/routers.py

I have no idea if this is the "right" way to go about it, but the DefaultRouter is commonly used in cases where APIs are entirely HATEOAS-driven.

@chibisov
Copy link
Owner Author

@kevin-brown, how can we show nested resources in root page? For any nested resource we need parent PKs to compose uri. I think we just should handle NoReverseMatch, like you did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants