From 72c6187d0d97687dabb463821fe04311f71158ac Mon Sep 17 00:00:00 2001 From: karthik mv Date: Thu, 9 Nov 2023 19:44:57 +0530 Subject: [PATCH] Update companyViews.py --- CDC_Backend/APIs/companyViews.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index d721b12..5611b45 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -418,13 +418,14 @@ def addInternship(request): internship.is_work_from_home = True else: internship.is_work_from_home = False - - if ALLOWED_BATCH in data[ALLOWED_BATCH] and data[ALLOWED_BATCH] is None or json.loads(data[ALLOWED_BATCH]) == "": + + if ALLOWED_BATCH in data and (data[ALLOWED_BATCH] is None or json.loads(data[ALLOWED_BATCH]) == ""): raise ValueError('Allowed Batches cannot be empty') - elif ALLOWED_BATCH in data[ALLOWED_BATCH] and set(json.loads(data[ALLOWED_BATCH])).issubset(BATCHES): + elif ALLOWED_BATCH in data and set(json.loads(data[ALLOWED_BATCH])).issubset(BATCHES): internship.allowed_batch = json.loads(data[ALLOWED_BATCH]) else: internship.allowed_batch = ['2021'] + if data[ALLOWED_BRANCH] is None or json.loads(data[ALLOWED_BRANCH]) == "": raise ValueError('Allowed Branch cannot be empty')