コード例 #1
0
ファイル: urls.py プロジェクト: FarahhM/ClassroomsAPI
urlpatterns = [
    path('admin/', admin.site.urls),
    path('classrooms/', views.classroom_list, name='classroom-list'),
    path('classrooms/<int:classroom_id>/',
         views.classroom_detail,
         name='classroom-detail'),
    path('classrooms/create', views.classroom_create, name='classroom-create'),
    path('classrooms/<int:classroom_id>/update/',
         views.classroom_update,
         name='classroom-update'),
    path('classrooms/<int:classroom_id>/delete/',
         views.classroom_delete,
         name='classroom-delete'),
    path('api/list/', ClassroomListView.as_view(), name='api-list'),
    path('detail/<int:classroom_id>/', DetailView.as_view(), name='detail'),
    path('api/create/', CreateView.as_view(), name='api-create'),
    path('api/<int:classroom_id>/update/',
         UpdateView.as_view(),
         name='api-update'),
    path('api/<int:classroom_id>/delete/',
         DeleteView.as_view(),
         name='api-delete'),
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
コード例 #2
0
from api.views import RouteIdView, RoutesStopidView, PredictTimeView, DirectionView, LocationView, \
    error_404, error_500, StaticFileView, UserPlaceView, SavePlaceView, SignUpView, DeleteView
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from rest_framework_jwt.views import obtain_jwt_token

urlpatterns = [
    re_path('^$',
            TemplateView.as_view(template_name="index.html"),
            name="index"),
    re_path('^login$',
            TemplateView.as_view(template_name="index.html"),
            name="index"),
    path('admin/', admin.site.urls),
    path('api/allroutes', RouteIdView.as_view()),
    path('api/station', RoutesStopidView.as_view()),
    path('api/direction', DirectionView.as_view()),
    path('api/time', PredictTimeView.as_view()),
    path('api/googleroute', LocationView.as_view()),
    path('api/static', StaticFileView.as_view()),
    re_path(r'^api/login$', obtain_jwt_token),
    re_path(r'^api/userdata$', UserPlaceView.as_view()),
    re_path(r'^api/savedata$', SavePlaceView.as_view()),
    re_path(r'^api/signup$', SignUpView.as_view()),
    re_path(r'^api/deletejourney$', DeleteView.as_view())
]

urlpatterns += staticfiles_urlpatterns()

handler404 = error_404
handler500 = error_500
コード例 #3
0
from django.conf.urls.static import static
from classes import views
from api.views import (
	ListView,
	DetailView,
	CreateView,
	UpdateView,
	DeleteView,
	)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('classrooms/', views.classroom_list, name='classroom-list'),
    path('classrooms/<int:classroom_id>/', views.classroom_detail, name='classroom-detail'),

    path('classrooms/create', views.classroom_create, name='classroom-create'),
    path('classrooms/<int:classroom_id>/update/', views.classroom_update, name='classroom-update'),
    path('classrooms/<int:classroom_id>/delete/', views.classroom_delete, name='classroom-delete'),

    path('api/list/', ListView.as_view(), name='api-list'),
    path('api/<int:classroom_id>/', DetailView.as_view(), name='api-detail'),

    path('api/create', CreateView.as_view(), name='api-create'),
    path('api/<int:classroom_id>/update/', UpdateView.as_view(), name='api-update'),
    path('api/<int:classroom_id>/delete/', DeleteView.as_view(), name='api-delete'),
]

if settings.DEBUG:
	urlpatterns+=static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
	urlpatterns+=static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
コード例 #4
0
ファイル: urls.py プロジェクト: violettalivada/final_exam
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path

from api.views import AddView, DeleteView

app_name = 'api'

urlpatterns = [
    path('<int:pk>/add/', AddView.as_view(), name='add_friend'),
    path('<int:pk>/delete', DeleteView.as_view(), name='del_friend'),
]