Merge branch 'main' of https://git.intra.yksa.space/afanasyev.aa/api-drf-1
This commit is contained in:
commit
2ec289f3c7
3 changed files with 85 additions and 75 deletions
38
api/urls.py
38
api/urls.py
|
|
@ -1,23 +1,32 @@
|
|||
from django.urls import path
|
||||
from .views import (PredictionCreateView, PredictionListView,
|
||||
PredictionHistoryListView,
|
||||
PredictionHistoryDetailView,
|
||||
PredictionHistoryDeleteView,
|
||||
SessionView,
|
||||
WhoAmIView,
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from rest_framework.authtoken.views import obtain_auth_token
|
||||
from .views import (
|
||||
PredictionViewSet,
|
||||
SavedPointViewset,
|
||||
TelemetryListCreateView,
|
||||
get_csrf,
|
||||
login_view,
|
||||
logout_view)
|
||||
from rest_framework.authtoken.views import obtain_auth_token
|
||||
from .views import TelemetryListCreateView
|
||||
logout_view,
|
||||
SessionView,
|
||||
WhoAmIView
|
||||
)
|
||||
|
||||
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register(r'predictions', PredictionViewSet, basename='predictions')
|
||||
router.register(r'saved-points', SavedPointViewset, basename='saved-points')
|
||||
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('predictions', PredictionCreateView.as_view(), name='create_prediction'),
|
||||
path('predictions/list/', PredictionListView.as_view(), name='get_predictions'),
|
||||
path("csrf/", get_csrf, name='api-csrf'),
|
||||
path('token', obtain_auth_token, name = 'get_token'),
|
||||
path("history", PredictionHistoryListView.as_view(), name='view_history_list'),
|
||||
path("history/<uuid:pk>/", PredictionHistoryDetailView.as_view(), name='view_history_detail'),
|
||||
path("history/<uuid:pk>/delete/", PredictionHistoryDeleteView.as_view(), name='delete_history'),
|
||||
path("login/", login_view, name='api-login'),
|
||||
path("logout/", logout_view, name='api-logout'),
|
||||
path("session/", SessionView.as_view(), name='api-session'),
|
||||
path("whoami/", WhoAmIView.as_view(), name='api-whoami'),
|
||||
path("<uuid:pk>/telemetry/", TelemetryListCreateView.as_view(), name="create_telemetry"),
|
||||
path('saved-points/', SavedPointViewset.as_view({'get': 'list', 'post': 'create'}), name='saved_points'),
|
||||
path('saved-points/<int:pk>/', SavedPointViewset.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'}), name='saved_point_detail'),
|
||||
|
|
@ -27,3 +36,4 @@ urlpatterns = [
|
|||
path('session/', SessionView.as_view(), name='api-session'), # new
|
||||
path('whoami/', WhoAmIView.as_view(), name='api-whoami'), # new
|
||||
]
|
||||
urlpatterns += router.urls
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue