from django.conf.urls import url, include from rest_framework_nested.routers import SimpleRouter, NestedSimpleRouter from api.event import views router = SimpleRouter() router.register(r'event', views.EventViewSet) router.register(r'place', views.PlaceViewSet) router.register(r'tag', views.ActivityTagViewSet) # Views behind /event//... event_router = NestedSimpleRouter(router, r'event', lookup='event') event_router.register(r'place', views.PlaceViewSet) event_router.register(r'tag', views.ActivityTagViewSet) event_router.register(r'template', views.ActivityTemplateViewSet) # API URLconf: routers + auth for browsable API. urlpatterns = [ url(r'^', include(router.urls)), url(r'^', include(event_router.urls)), url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')), ]