commit
0d04806ea1
|
@ -304,11 +304,9 @@ def verifyEmail(request):
|
||||||
return Response({'action': "Verify Email", 'message': "Opening Not Found"},
|
return Response({'action': "Verify Email", 'message': "Opening Not Found"},
|
||||||
status=status.HTTP_404_NOT_FOUND)
|
status=status.HTTP_404_NOT_FOUND)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
print(traceback.format_exc())
|
|
||||||
return Response({'action': "Verify Email", 'message': str(e)},
|
return Response({'action': "Verify Email", 'message': str(e)},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
except:
|
except:
|
||||||
print(traceback.format_exc())
|
|
||||||
logger.warning("Verify Email: " + str(sys.exc_info()))
|
logger.warning("Verify Email: " + str(sys.exc_info()))
|
||||||
return Response({'action': "Verify Email", 'message': "Something went wrong"},
|
return Response({'action': "Verify Email", 'message': "Something went wrong"},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
@ -354,7 +352,6 @@ def addInternship(request):
|
||||||
if not verify_recaptcha(data[RECAPTCHA_VALUE]):
|
if not verify_recaptcha(data[RECAPTCHA_VALUE]):
|
||||||
raise Exception("Recaptcha Failed")
|
raise Exception("Recaptcha Failed")
|
||||||
|
|
||||||
print(internship)
|
|
||||||
internship.id = generateRandomString()
|
internship.id = generateRandomString()
|
||||||
# Add a company details in the internship
|
# Add a company details in the internship
|
||||||
internship.company_name = data[COMPANY_NAME]
|
internship.company_name = data[COMPANY_NAME]
|
||||||
|
@ -407,9 +404,9 @@ def addInternship(request):
|
||||||
internship.interning_period_to = datetime.datetime.strptime(data[END_DATE], '%d-%m-%Y').date()
|
internship.interning_period_to = datetime.datetime.strptime(data[END_DATE], '%d-%m-%Y').date()
|
||||||
|
|
||||||
if data[WORK_TYPE] == 'Work from home':
|
if data[WORK_TYPE] == 'Work from home':
|
||||||
internship.work_from_home = True
|
internship.is_work_from_home = True
|
||||||
else:
|
else:
|
||||||
internship.work_from_home = False
|
internship.is_work_from_home = False
|
||||||
if data[ALLOWED_BRANCH] is None:
|
if data[ALLOWED_BRANCH] is None:
|
||||||
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):
|
||||||
|
@ -418,24 +415,24 @@ def addInternship(request):
|
||||||
raise ValueError('Allowed Branch must be a subset of ' + str(BRANCHES))
|
raise ValueError('Allowed Branch must be a subset of ' + str(BRANCHES))
|
||||||
|
|
||||||
if data[SOPHOMORES_ELIIGIBLE] == 'Yes':
|
if data[SOPHOMORES_ELIIGIBLE] == 'Yes':
|
||||||
internship.sophomores_eligible = True
|
internship.sophomore_eligible = True
|
||||||
else:
|
else:
|
||||||
internship.sophomores_eligible = False
|
internship.sophomore_eligible = False
|
||||||
if data[RS_ELIGIBLE] == 'Yes':
|
if data[RS_ELIGIBLE] == 'Yes':
|
||||||
internship.rs_eligible = True
|
internship.rs_eligible = True
|
||||||
else:
|
else:
|
||||||
internship.rs_eligible = False
|
internship.rs_eligible = False
|
||||||
if data[NUM_OFFERS].isdigit():
|
if data[NUM_OFFERS].isdigit():
|
||||||
internship.num_offers = int(data[NUM_OFFERS])
|
internship.tentative_no_of_offers = int(data[NUM_OFFERS])
|
||||||
else:
|
else:
|
||||||
raise ValueError('Number of offers must be an integer')
|
raise ValueError('Number of offers must be an integer')
|
||||||
|
|
||||||
if data[IS_STIPEND_DETAILS_PDF] == "true":
|
if data[IS_STIPEND_DETAILS_PDF] == "true":
|
||||||
internship.is_stipend_details_pdf = True
|
internship.is_stipend_description_pdf = True
|
||||||
else:
|
else:
|
||||||
internship.is_stipend_details_pdf = False
|
internship.is_stipend_description_pdf = False
|
||||||
|
|
||||||
if internship.is_stipend_details_pdf:
|
if internship.is_stipend_description_pdf:
|
||||||
stipend_details_pdf = []
|
stipend_details_pdf = []
|
||||||
for file in files.getlist(STIPEND_DETAILS_PDF):
|
for file in files.getlist(STIPEND_DETAILS_PDF):
|
||||||
file_location = STORAGE_DESTINATION_COMPANY_ATTACHMENTS + internship.id + '/'
|
file_location = STORAGE_DESTINATION_COMPANY_ATTACHMENTS + internship.id + '/'
|
||||||
|
@ -449,7 +446,7 @@ def addInternship(request):
|
||||||
|
|
||||||
if data[FACILITIES] != "":
|
if data[FACILITIES] != "":
|
||||||
if set(json.loads(data[FACILITIES])).issubset(FACILITIES_CHOICES):
|
if set(json.loads(data[FACILITIES])).issubset(FACILITIES_CHOICES):
|
||||||
internship.facilities = json.loads(data[FACILITIES])
|
internship.facilities_provided = json.loads(data[FACILITIES])
|
||||||
else:
|
else:
|
||||||
raise ValueError('Facilities must be a subset of ' + str(FACILITIES_CHOICES))
|
raise ValueError('Facilities must be a subset of ' + str(FACILITIES_CHOICES))
|
||||||
else:
|
else:
|
||||||
|
@ -465,6 +462,7 @@ def addInternship(request):
|
||||||
raise ValueError('Selection Procedure Rounds must be a list')
|
raise ValueError('Selection Procedure Rounds must be a list')
|
||||||
|
|
||||||
internship.selection_procedure_details = data[SELECTION_PROCEDURE_DETAILS]
|
internship.selection_procedure_details = data[SELECTION_PROCEDURE_DETAILS]
|
||||||
|
|
||||||
if data[IS_SELECTION_PROCEDURE_DETAILS_PDF] == "true":
|
if data[IS_SELECTION_PROCEDURE_DETAILS_PDF] == "true":
|
||||||
internship.is_selection_procedure_details_pdf = True
|
internship.is_selection_procedure_details_pdf = True
|
||||||
else:
|
else:
|
||||||
|
@ -476,7 +474,9 @@ def addInternship(request):
|
||||||
file_location = STORAGE_DESTINATION_COMPANY_ATTACHMENTS + internship.id + '/'
|
file_location = STORAGE_DESTINATION_COMPANY_ATTACHMENTS + internship.id + '/'
|
||||||
selection_procedure_details_pdf.append(saveFile(file, file_location))
|
selection_procedure_details_pdf.append(saveFile(file, file_location))
|
||||||
internship.selection_procedure_details_pdf_names = selection_procedure_details_pdf
|
internship.selection_procedure_details_pdf_names = selection_procedure_details_pdf
|
||||||
internship.other_requirements = data[OTHER_REQUIREMENTS]
|
|
||||||
|
internship.additional_facilities = data[OTHER_FACILITIES]
|
||||||
|
internship.academic_requirements = data[OTHER_REQUIREMENTS]
|
||||||
|
|
||||||
|
|
||||||
internship.contact_person_name = data[CONTACT_PERSON_NAME]
|
internship.contact_person_name = data[CONTACT_PERSON_NAME]
|
||||||
|
@ -500,7 +500,7 @@ def addInternship(request):
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
store_all_files(request)
|
store_all_files(request)
|
||||||
# exception_email(data)
|
# exception_email(data)
|
||||||
logger.info("ValueError in addInternship: " + str(e))
|
logger.warning("ValueError in addInternship: " + str(e))
|
||||||
return Response({'action': "Add Internship", 'message': str(e)},
|
return Response({'action': "Add Internship", 'message': str(e)},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -195,7 +195,7 @@ IS_STIPEND_DETAILS_PDF = 'is_stipend_details_pdf'
|
||||||
STIPEND = 'stipend'
|
STIPEND = 'stipend'
|
||||||
FACILITIES = 'facilities'
|
FACILITIES = 'facilities'
|
||||||
OTHER_FACILITIES = 'other_facilities'
|
OTHER_FACILITIES = 'other_facilities'
|
||||||
STIPEND_DETAILS_PDF = 'stipend_details_pdf'
|
STIPEND_DETAILS_PDF = 'compensation_details_pdf'
|
||||||
|
|
||||||
SEASONS = (
|
SEASONS = (
|
||||||
'Summer',
|
'Summer',
|
||||||
|
|
|
@ -346,8 +346,8 @@ class Internship(models.Model):
|
||||||
contact_person_name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
contact_person_name = models.CharField(blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
||||||
phone_number = models.PositiveBigIntegerField(blank=False)
|
phone_number = models.PositiveBigIntegerField(blank=False)
|
||||||
email = models.EmailField(blank=False)
|
email = models.EmailField(blank=False)
|
||||||
contact_person_designation = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
# contact_person_designation = models.CharField(blank=False, max_length=JNF_SMALLTEXT_MAX_CHARACTER_COUNT, default="")
|
||||||
telephone_number = models.PositiveBigIntegerField(blank=True, default=None, null=True)
|
# telephone_number = models.PositiveBigIntegerField(blank=True, default=None, null=True)
|
||||||
email_verified = models.BooleanField(blank=False, default=False)
|
email_verified = models.BooleanField(blank=False, default=False)
|
||||||
#history
|
#history
|
||||||
created_at = models.DateTimeField(blank=False, default=None, null=True)
|
created_at = models.DateTimeField(blank=False, default=None, null=True)
|
||||||
|
@ -387,8 +387,8 @@ class Internship(models.Model):
|
||||||
self.additional_facilities = self.additional_facilities.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
self.additional_facilities = self.additional_facilities.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
||||||
if self.academic_requirements is not None:
|
if self.academic_requirements is not None:
|
||||||
self.academic_requirements = self.academic_requirements.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
self.academic_requirements = self.academic_requirements.strip()[:JNF_TEXTAREA_MAX_CHARACTER_COUNT]
|
||||||
if self.contact_person_designation is not None:
|
# if self.contact_person_designation is not None:
|
||||||
self.contact_person_designation = self.contact_person_designation.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
# self.contact_person_designation = self.contact_person_designation.strip()[:JNF_SMALLTEXT_MAX_CHARACTER_COUNT]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _history_user(self):
|
def _history_user(self):
|
||||||
|
|
Loading…
Reference in New Issue