src/notes/api/urls.py
author ymh <ymh.work@gmail.com>
Fri, 30 Nov 2018 10:53:15 +0100
changeset 183 f8f3af9e5c83
parent 126 ba8bc0199464
permissions -rw-r--r--
Change the settings to avoid using Session authentication for rest framework as it raise exceptions in case client and backend are on the same domain On the filter, adapt to take into account new version of django_filters

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

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)),
    url(r'sync/', ListLogsView.as_view(), name='sync-list')
]