diff options
Diffstat (limited to 'config/base_urls.py')
-rw-r--r-- | config/base_urls.py | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/config/base_urls.py b/config/base_urls.py index 84dd56d..953ceae 100644 --- a/config/base_urls.py +++ b/config/base_urls.py @@ -9,25 +9,39 @@ from django_registration.backends.activation.views import RegistrationView from rest_framework import routers from pages.views import PageDetailView -from notes.views import NoteViewSet, FolderViewSet, NoteListView from accounts.forms import UserForm - +from notes.views import ( + NoteViewSet, + NotebookViewSet, + NoteListView, +) router = routers.DefaultRouter() -router.register(r'<str:user>/notes/folder/', FolderViewSet, basename="folder-api") -router.register(r'<str:user>/notes/', NoteViewSet, basename="notes-api") - +router.register(r'notes/notebook/', NotebookViewSet, basename="notebook-api") +router.register(r'notes', NoteViewSet, basename="notes-api") +ADMIN_URL = 'https://docs.djangoproject.com/en/dev/ref/contrib/admin/' urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += [ - path('admin/', admin.site.urls), + path('admin/', RedirectView.as_view(url=ADMIN_URL)), + path('magux/', admin.site.urls), path(r'accounts/', include('django_registration.backends.activation.urls')), path(r'accounts/', include('django.contrib.auth.urls')), path(r'register/', RegistrationView.as_view(form_class=UserForm), name='django_registration_register',), path(r'settings/', include('accounts.urls')), path(r'', include('django_registration.backends.activation.urls')), path(r'', include('django.contrib.auth.urls')), - path(r'', include('notes.urls')), - path(r'<slug>', PageDetailView.as_view(), name="pages"), - path(r'<path>/<slug>/', PageDetailView.as_view(), name="pages"), + path(r'', NoteListView.as_view(), name='homepage',), + path(r'notes/', include('notes.urls')), path(r'api/', include(router.urls)), + path(r'<slug>', PageDetailView.as_view(), name="pages"), + #path(r'<path>/<slug>/', PageDetailView.as_view(), name="pages"), path(r'api-auth/', include('rest_framework.urls', namespace='rest_framework')) ] +if settings.DEBUG: + import debug_toolbar + urlpatterns = [ + path('__debug__/', include(debug_toolbar.urls)), + + # For django versions before 2.0: + # url(r'^__debug__/', include(debug_toolbar.urls)), + + ] + urlpatterns |