示例#1
0
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static

from rest_framework.documentation import include_docs_urls
from rest_framework_jwt.views import obtain_jwt_token

from fleet_management.api import (
    CarListView,
    CurrentUserRetrieveView,
    DriveView,
    PassengerListView,
    ProjectView,
)


urlpatterns = [
    path("admin/", admin.site.urls),
    path("api/docs/", include_docs_urls(title="PAH-FM", public=False)),
    path("api/api-token-auth/", obtain_jwt_token, name="jwt"),
    path("api/users/me", CurrentUserRetrieveView.as_view(), name="me"),
    path("api/passengers", PassengerListView.as_view(), name="passengers"),
    path("api/cars", CarListView.as_view(), name="cars"),
    path("api/drives", DriveView.as_view(), name="drives"),
    path("api/projects", ProjectView.as_view(), name="projects"),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
示例#2
0
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static

from rest_framework.documentation import include_docs_urls
from rest_framework_jwt.views import obtain_jwt_token

from fleet_management.api import (
    CarListView,
    CurrentUserRetrieveView,
    DriveView,
    PassengerListView,
    ProjectView,
    VerificationTokenView,
)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/docs/', include_docs_urls(title='PAH-FM', public=False)),
    path('api/api-token-auth/', obtain_jwt_token),
    path('api/users/me', CurrentUserRetrieveView.as_view(), name='me'),
    path('api/passengers', PassengerListView.as_view(), name='passengers'),
    path('api/cars', CarListView.as_view(), name='cars'),
    path('api/drives', DriveView.as_view(), name='drives'),
    path('api/projects', ProjectView.as_view(), name='projects'),
    path('api/verification-token/<uuid:token>',
         VerificationTokenView.as_view(),
         name='verification-token')
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)