Open sodrooome opened 5 years ago
going to add to this topic, as it seems related - at this moment, it seems like NestedDefaultRouter is not working properly too. Or maybe missing its whole "DefaultRouter" purpose.
Doing things the following way gives me the very same RuntimeError OP has got:
from rest_framework_nested import routers
router = routers.DefaultRouter()
category_router = routers.NestedDefaultRouter(
parent_router=router,
parent_prefix="category",
)
Doing things the following way kinda work:
from rest_framework_nested import routers
from views import TestViewSet, Foo, Bar
router = routers.DefaultRouter()
router.register(
prefix="test",
viewset=TestViewSet,
)
category_router = routers.NestedDefaultRouter(
parent_router=router,
parent_prefix="test",
)
category_router.register(
prefix="foo",
viewset=Foo,
)
category_router.register(
prefix="bar",
viewset=Bar,
)
I mean - router itself now works, I'm able to get to /test/ endpoint. However, it does not work as a default router.
What I've expected:
What I've got:
Am I doing it wrong, or? How do I correctly get a DefaultRouter-like behavior (router that renders a list of endpoints attached to it on its base endpoint) on a nested router?
I was wondering if I could get your help on this, so i would like to create a single nested simple router but unfortunately, it's result the error like
RuntimeError: parent registered resource not found
.here's my urls.py which contains the following code like this:
I can't seem to figure out why this error is still occurring, any help would be much appreciated