urls.py 1.54 KB
from django.urls import path, include
from . import views
from rest_framework.authtoken.views import obtain_auth_token
from rest_framework import routers, renderers
from django.views.generic import TemplateView
from rest_framework.schemas import get_schema_view 

router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'sequences', views.SequenceViewSet)
router.register(r'albums', views.AlbumViewSet)
router.register(r'plans', views.PlanViewSet)
router.register(r'full_sequences', views.FullSequenceViewSet)
router.register(r'scientific_programs', views.ScientificProgramViewSet)
router.register(r'sp_period', views.SPPeriodViewSet)
router.register(r'agent_survey', views.AgentSurveyViewSet)
router.register(r'agent_cmd', views.AgentCmdViewSet)
router.register(r'env_data', views.EnvDataViewSet)
router.register(r'sensor_data_last', views.SensorDataLastViewSet)

urlpatterns = [
    path('', include(router.urls)),
    path('logout/', views.user_logout, name='logout'),
    path('api-token-auth/', obtain_auth_token, name='api_token_auth'),
    path("submit_sequence", views.submit_sequence_file,
         name="api_submit_sequence"),
    path("agent_cmd/<str:agent_name>",views.AgentCmdViewSet.as_view({'get': 'list'})),
    path("openapi-schema",get_schema_view(
            title='PyROS API',
            version="1.0.0",
    ), name="openapi-schema"),
    path('docs/', TemplateView.as_view(
        template_name='api/swagger-ui.html',
        extra_context={'schema_url': 'openapi-schema'}
    ), name='api_doc'),
] + router.urls