From 79626fb31d04bec628590efad5391aadf3c1133c Mon Sep 17 00:00:00 2001
From: sandeepsajan0 <sandeepsajan0@gmail.com>
Date: Mon, 23 May 2022 17:57:49 +0530
Subject: [PATCH] Remove draft submissions from API calls

---
 hypha/apply/api/v1/filters.py | 2 +-
 hypha/apply/api/v1/views.py   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hypha/apply/api/v1/filters.py b/hypha/apply/api/v1/filters.py
index 23764e78c..025aa4f9a 100644
--- a/hypha/apply/api/v1/filters.py
+++ b/hypha/apply/api/v1/filters.py
@@ -45,7 +45,7 @@ class SubmissionsFilter(filters.FilterSet):
     )
     id = filters.ModelMultipleChoiceFilter(
         field_name='id',
-        queryset=ApplicationSubmission.objects.current().with_latest_update(),
+        queryset=ApplicationSubmission.objects.exclude_draft().current().with_latest_update(),
         method='filter_id'
     )
 
diff --git a/hypha/apply/api/v1/views.py b/hypha/apply/api/v1/views.py
index b5b9e2baa..be67214ed 100644
--- a/hypha/apply/api/v1/views.py
+++ b/hypha/apply/api/v1/views.py
@@ -62,8 +62,8 @@ class SubmissionViewSet(viewsets.ReadOnlyModelViewSet, viewsets.GenericViewSet):
 
     def get_queryset(self):
         if self.action == 'list':
-            return ApplicationSubmission.objects.current().with_latest_update()
-        return ApplicationSubmission.objects.all().prefetch_related(
+            return ApplicationSubmission.objects.exclude_draft().current().with_latest_update()
+        return ApplicationSubmission.objects.exclude_draft().prefetch_related(
             Prefetch('reviews', Review.objects.submitted()),
         )
 
-- 
GitLab