feat: implement filtering of tasks by status in the TaskViewSet class
This commit is contained in:
parent
b4e7cfdab0
commit
1d7b836eb6
1 changed files with 7 additions and 1 deletions
|
|
@ -6,6 +6,12 @@ class TaskViewSet(viewsets.ModelViewSet):
|
|||
queryset = Task.objects.all()
|
||||
serializer_class = TaskSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
status = self.request.query_params.get('status', None)
|
||||
if status:
|
||||
return Task.objects.filter(status=status)
|
||||
return Task.objects.all()
|
||||
|
||||
class SubTaskViewSet(viewsets.ModelViewSet):
|
||||
queryset = SubTask.objects.all()
|
||||
serializer_class = SubTaskSerializer
|
||||
|
|
|
|||
Loading…
Reference in a new issue