Commit 858d80af authored by Jorrit Schaap's avatar Jorrit Schaap

TMSS-153: added url for subtask_templates to get a default specification for the given schema

parent 93602ec8
......@@ -5,6 +5,7 @@ set(_py_files
__init__.py
admin.py
apps.py
views.py
populate.py
)
......
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404
from lofar.sas.tmss.tmss.tmssapp.models.scheduling import SubtaskTemplate
from lofar.common.json_utils import get_default_json_object_for_schema
def subtask_template_default_specification(request, subtask_template_pk:int):
subtask_template = get_object_or_404(SubtaskTemplate, pk=subtask_template_pk)
spec = get_default_json_object_for_schema(subtask_template.schema)
return JsonResponse(spec)
......@@ -21,7 +21,7 @@ from django.conf.urls import url, include
from django.views.generic.base import TemplateView
from rest_framework import routers, permissions
from .tmssapp import viewsets, models, serializers
from .tmssapp import viewsets, models, serializers, views
from rest_framework.documentation import include_docs_urls
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
......@@ -121,6 +121,7 @@ router.register(r'default_subtask_template', viewsets.DefaultSubtaskTemplateView
router.register(r'default_dataproduct_specifications_template', viewsets.DefaultDataproductSpecificationsTemplateViewSet)
router.register(r'subtask_input_selection_template', viewsets.SubtaskInputSelectionTemplateViewSet)
router.register(r'dataproduct_feedback_template', viewsets.DataproductFeedbackTemplateViewSet)
urlpatterns.append(re_path(r'subtask_template/(?P<subtask_template_pk>\d+)/default_specification', views.subtask_template_default_specification))
# instances
#router.register(r'subtask', viewsets.SubtaskViewSet) # todo: default view, re-activate or remove the JSON editor one in bottom
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment