Commit d632e00d authored by Roy de Goei's avatar Roy de Goei

TMSS-154: Add filters to query on subtasks including unittest

parent a37a10ae
......@@ -7,6 +7,7 @@ from rest_framework import viewsets
from .lofar_viewset import LOFARViewSet
from .. import models
from .. import serializers
from django_filters import rest_framework as filters
class SubtaskConnectorViewSet(LOFARViewSet):
queryset = models.SubtaskConnector.objects.all()
......@@ -77,9 +78,18 @@ class DataproductFeedbackTemplateViewSet(LOFARViewSet):
serializer_class = serializers.DataproductFeedbackTemplateSerializer
class subTaskFilter(filters.FilterSet):
class Meta:
model = Subtask
fields = {}
class SubtaskViewSet(LOFARViewSet):
queryset = models.Subtask.objects.all()
serializer_class = serializers.SubtaskSerializer
filter_class = subTaskFilter
def get_queryset(self):
if 'task_blueprint_pk' in self.kwargs:
......
# Load testdata for subtask query
# Use manage.py with the next environment variables:
# export TMSS_DBCREDENTIALS=02949506-2c13-4028-a27a-c35cc69bc0ec
# export TMSS_LDAPCREDENTIALS=0a2d3d5c-f757-4476-9331-72093f754c
# Execute:
/usr/bin/python3 build/gnucxx11_opt/lib/python3.6/site-packages/lofar/sas/tmss/manage.py loaddata ./SAS/TMSS/test/testdata/subtasks.json
\ No newline at end of file
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