router = routers.SimpleRouter() router.register(r'quiz', QuizViewSet) quiz_router = routers.NestedSimpleRouter(router, r'quiz') quiz_router.register(r'questions', QuestionViewSet) url_patterns = patterns('',
url(r'^', include(router.urls))
url(r'^', include(quiz_router.urls)), )
This creates the following URLs:
^quiz/$ [name='quiz-list']
^quiz/(?P<pk>[^/]+)/$ [name='quiz-detail']
^quiz/(?P<nested_1_pk>[^/]+)/questions/$ [name='question-list']
^quiz/(?P<nested_1_pk>[^/]+)/questions/(?P<pk>[^/]+)/$ [name='question-detail']
--
You received this message because you are subscribed to a topic in the Google Groups "Django REST framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-rest-framework/Sv03dCVNn-U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.