2017-07-18 17:48:59 +02:00
|
|
|
from django.conf.urls import url, include
|
2017-08-03 12:14:53 +02:00
|
|
|
|
2017-07-21 17:03:33 +02:00
|
|
|
from rest_framework_nested.routers import SimpleRouter, NestedSimpleRouter
|
2017-07-18 17:48:59 +02:00
|
|
|
|
2017-08-03 12:14:53 +02:00
|
|
|
from api.event import views
|
|
|
|
|
|
|
|
|
2017-07-21 17:03:33 +02:00
|
|
|
router = SimpleRouter()
|
2017-08-03 12:14:53 +02:00
|
|
|
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
|
|
|
|
2017-08-03 12:14:53 +02:00
|
|
|
# Views behind /event/<event_pk>/...
|
2017-07-21 17:03:33 +02:00
|
|
|
event_router = NestedSimpleRouter(router, r'event', lookup='event')
|
2017-08-03 12:14:53 +02:00
|
|
|
event_router.register(r'place', views.PlaceViewSet)
|
|
|
|
event_router.register(r'tag', views.ActivityTagViewSet)
|
|
|
|
event_router.register(r'template', views.ActivityTemplateViewSet)
|
2017-07-21 17:03:33 +02:00
|
|
|
|
|
|
|
|
2017-08-03 12:14:53 +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)),
|
2017-08-03 12:14:53 +02:00
|
|
|
url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
|
2017-07-18 17:48:59 +02:00
|
|
|
]
|