From beeb889dee367859e3f540dc1cc87f2abe304ba5 Mon Sep 17 00:00:00 2001 From: Yogesh Ojha Date: Sat, 20 Jul 2024 08:37:42 +0530 Subject: [PATCH] make subdomain id as optional --- web/api/views.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/web/api/views.py b/web/api/views.py index 02631656..b914ac4a 100644 --- a/web/api/views.py +++ b/web/api/views.py @@ -577,13 +577,14 @@ class AddReconNote(APIView): note.description = description # get scan history for subdomain_id - subdomain = Subdomain.objects.get(id=subdomain_id) - note.subdomain = subdomain + if subdomain_id: + subdomain = Subdomain.objects.get(id=subdomain_id) + note.subdomain = subdomain - # also get scan history - scan_history_id = subdomain.scan_history.id - scan_history = ScanHistory.objects.get(id=scan_history_id) - note.scan_history = scan_history + # also get scan history + scan_history_id = subdomain.scan_history.id + scan_history = ScanHistory.objects.get(id=scan_history_id) + note.scan_history = scan_history note.project = project note.save()