src/notes/api/urls.py
author ymh <ymh.work@gmail.com>
Wed, 19 Jul 2017 15:57:13 +0200
changeset 119 8ff8e2aee0f9
parent 31 63be3ce389f7
child 126 ba8bc0199464
permissions -rw-r--r--
add parameter to filter session and note by updated date. Add pagination on sessions and notes. add read only endpoint at root level to list notes

from django.conf.urls import url, include
from rest_framework_nested import routers
from .views import SessionViewSet, NoteViewSet, RootNoteViewSet

router = routers.SimpleRouter()
router.register(r'sessions', SessionViewSet, base_name='session')
router.register(r'notes', RootNoteViewSet, base_name='note')

session_router = routers.NestedSimpleRouter(router, r'sessions', lookup='session')
session_router.register(r'notes', NoteViewSet, base_name='notes-session')

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^', include(session_router.urls)),
]