Merge pull request #189 from CDC-IITDH/karthikmurakonda-patch-3

Update companyViews.py
This commit is contained in:
uttamthummala 2023-11-09 19:47:43 +05:30 committed by GitHub
commit 6c484c1292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -419,13 +419,14 @@ def addInternship(request):
else: else:
internship.is_work_from_home = False 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') 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]) internship.allowed_batch = json.loads(data[ALLOWED_BATCH])
else: else:
internship.allowed_batch = ['2021'] internship.allowed_batch = ['2021']
if data[ALLOWED_BRANCH] is None or json.loads(data[ALLOWED_BRANCH]) == "": if data[ALLOWED_BRANCH] is None or json.loads(data[ALLOWED_BRANCH]) == "":
raise ValueError('Allowed Branch cannot be empty') raise ValueError('Allowed Branch cannot be empty')
elif set(json.loads(data[ALLOWED_BRANCH])).issubset(BRANCHES): elif set(json.loads(data[ALLOWED_BRANCH])).issubset(BRANCHES):