Commit 7f9242b7 authored by Roy de Goei's avatar Roy de Goei

TMSS-154: Update after review comment

parent 13a59263
......@@ -154,6 +154,8 @@ class DataproductHashViewSet(LOFARViewSet):
class SubtaskViewSetJSONeditorOnline(LOFARViewSet):
queryset = models.Subtask.objects.all()
serializer_class = serializers.SubtaskSerializerJSONeditorOnline
filter_backends = (filters.DjangoFilterBackend,)
filter_class = subTaskFilter
def get_view_name(self): # override name because DRF auto-naming does not produce something usable here
name = "Subtask"
......@@ -141,13 +141,7 @@ router.register(r'task_relation_blueprint', viewsets.TaskRelationBlueprintViewSe
router.register(r'task_draft', viewsets.TaskDraftViewSetJSONeditorOnline)
router.register(r'scheduling_unit_draft/(?P<scheduling_unit_draft_pk>\d+)/task_draft', viewsets.TaskDraftViewSetJSONeditorOnline)
#router.register(r'subtask', viewsets.SubtaskViewSetJSONeditorOnline)
router.register(r'subtask', viewsets.SubtaskViewSet)
# Rest API call to provide subtasks within window for a cluster For example:
# https://....../api/subtask?start_time__gt=2020-01-01T00:00:00&stop_time__lt=&2020-03-01-00:00:00&cluster=myCluster
#router.register(r'subtask_within_window', viewsets.SubtaskViewSetWithFilter)
router.register(r'subtask', viewsets.SubtaskViewSetJSONeditorOnline)
Provide model data with fixture files
Provide model data with fixture files, see
Note that the fixture file is NOT meant for production or unittest data. It is just an example how you can fill the
Django model/Database with data. It can be used for demo purposes or small manual testing.
Use the Django to loaddata from a json 'fixture' file
First set the next environment variables:
export TMSS_DBCREDENTIALS=<DB Credentials ID>
The environment variables are provided during startup of 'tmss_test_environment'
Finally Execute (in home of your project):
/usr/bin/python3 build/gnucxx11_opt/lib/python3.6/site-packages/lofar/sas/tmss/ loaddata ./SAS/TMSS/test/testdata/subtasks.json
\ No newline at end of file
/usr/bin/python3 build/gnucxx11_opt/lib/python3.6/site-packages/lofar/sas/tmss/ loaddata ./SAS/TMSS/test/testdata/subtasks.json
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