poulpe/api/urls.py

28 lines
883 B
Python
Raw Permalink Normal View History

2017-07-18 17:48:59 +02:00
from django.conf.urls import url, include
2017-07-21 17:03:33 +02:00
from rest_framework_nested.routers import SimpleRouter, NestedSimpleRouter
2017-07-18 17:48:59 +02:00
from api.event import views
2017-07-21 17:03:33 +02:00
router = SimpleRouter()
router.register(r'event', views.EventViewSet)
router.register(r'place', views.PlaceViewSet)
router.register(r'tag', views.ActivityTagViewSet)
2017-07-18 17:48:59 +02:00
# Views behind /event/<event_pk>/...
2017-07-21 17:03:33 +02:00
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)
event_router.register(r'activity', views.ActivityViewSet)
2017-07-21 17:03:33 +02:00
# API URLconf: routers + auth for browsable API.
2017-07-18 17:48:59 +02:00
urlpatterns = [
url(r'^', include(router.urls)),
2017-07-21 17:03:33 +02:00
url(r'^', include(event_router.urls)),
url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
2017-07-18 17:48:59 +02:00
]