Skip to content

Commit

Permalink
Merge pull request #189 from CDC-IITDH/karthikmurakonda-patch-3
Browse files Browse the repository at this point in the history
Update companyViews.py
  • Loading branch information
uttamthummala authored Nov 9, 2023
2 parents f6d27a9 + 72c6187 commit 6c484c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CDC_Backend/APIs/companyViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 6c484c1

Please sign in to comment.