This commit is contained in:
gowtham 2022-05-19 19:18:05 +05:30
commit 000aaf098a
4 changed files with 16 additions and 7 deletions

2
.gitignore vendored
View File

@ -135,5 +135,7 @@ dmypy.json
/CDC_Backend/CDC_Backend/__pycache__/ /CDC_Backend/CDC_Backend/__pycache__/
/CDC_Backend/APIs/__pycache__/ /CDC_Backend/APIs/__pycache__/
/CDC_Backend/APIs/migrations/ /CDC_Backend/APIs/migrations/
/CDC_Backend/static/
/CDC_Backend/Storage/
.idea .idea
*.pyc *.pyc

View File

@ -31,6 +31,7 @@ def addPlacement(request):
opening.nature_of_business = data[NATURE_OF_BUSINESS] opening.nature_of_business = data[NATURE_OF_BUSINESS]
opening.website = data[WEBSITE] opening.website = data[WEBSITE]
opening.company_details = data[COMPANY_DETAILS] opening.company_details = data[COMPANY_DETAILS]
opening.is_company_details_pdf = data[IS_COMPANY_DETAILS_PDF]
if opening.is_company_details_pdf: if opening.is_company_details_pdf:
company_details_pdf = [] company_details_pdf = []
@ -77,6 +78,7 @@ def addPlacement(request):
# Add a designation details in the opening # Add a designation details in the opening
opening.designation = data[DESIGNATION] opening.designation = data[DESIGNATION]
opening.description = data[DESCRIPTION] opening.description = data[DESCRIPTION]
opening.is_description_pdf = data[IS_DESCRIPTION_PDF]
if opening.is_description_pdf: if opening.is_description_pdf:
description_pdf = [] description_pdf = []
@ -128,6 +130,7 @@ def addPlacement(request):
raise ValueError('Compensation Bonus must be an integer') raise ValueError('Compensation Bonus must be an integer')
opening.compensation_details = data[COMPENSATION_DETAILS] opening.compensation_details = data[COMPENSATION_DETAILS]
opening.is_compensation_details_pdf = data[IS_COMPENSATION_DETAILS_PDF]
if opening.is_compensation_details_pdf: if opening.is_compensation_details_pdf:
compensation_details_pdf = [] compensation_details_pdf = []
@ -156,6 +159,7 @@ def addPlacement(request):
except: except:
raise ValueError('Selection Procedure Rounds must be a list') raise ValueError('Selection Procedure Rounds must be a list')
opening.selection_procedure_details = data[SELECTION_PROCEDURE_DETAILS] opening.selection_procedure_details = data[SELECTION_PROCEDURE_DETAILS]
opening.is_selection_procedure_details_pdf = data[IS_SELECTION_PROCEDURE_DETAILS_PDF]
if opening.is_selection_procedure_details_pdf: if opening.is_selection_procedure_details_pdf:
selection_procedure_details_pdf = [] selection_procedure_details_pdf = []

View File

@ -121,6 +121,12 @@ STUDENT_LIST = "student_list"
STUDENT_ID = "student_id" STUDENT_ID = "student_id"
STUDENT_SELECTED = "student_selected" STUDENT_SELECTED = "student_selected"
EXCLUDE_IN_PDF = ['id', 'is_company_details_pdf', 'offer_accepted', 'is_description_pdf',
'is_compensation_details_pdf', 'is_selection_procedure_details_pdf',
'email_verified', 'created_at']
SPECIAL_FORMAT_IN_PDF = ['website', 'company_details_pdf_names', 'description_pdf_names', 'compensation_details_pdf_names',
'selection_procedure_pdf_names']
COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT = "Notification Submitted - {id} - Career Development Cell, IIT Dharwad" COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT = "Notification Submitted - {id} - Career Development Cell, IIT Dharwad"
STUDENT_APPLICATION_STATUS_TEMPLATE_SUBJECT = 'Application Status : {company_name} - {id}' STUDENT_APPLICATION_STATUS_TEMPLATE_SUBJECT = 'Application Status : {company_name} - {id}'
STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted - {company_name}' STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted - {company_name}'

View File

@ -276,24 +276,21 @@ def verify_recaptcha(request):
def opening_description_table_html(opening): def opening_description_table_html(opening):
details = model_to_dict(opening, fields=[field.name for field in Placement._meta.fields], details = model_to_dict(opening, fields=[field.name for field in Placement._meta.fields],
exclude=['id', 'is_company_details_pdf', 'offer_accepted', 'is_description_pdf', exclude=EXCLUDE_IN_PDF)
'is_compensation_details_pdf', 'is_selection_procedure_details_pdf',
'email_verified'])
keys = list(details.keys()) keys = list(details.keys())
newdetails = {} newdetails = {}
for key in keys: for key in keys:
if isinstance(details[key], list): if isinstance(details[key], list):
details[key] = {"details": details[key], "type": ["list"]} details[key] = {"details": details[key], "type": ["list"]}
if key in ['website', 'company_details_pdf_names', 'description_pdf_names', 'compensation_details_pdf_names', if key in SPECIAL_FORMAT_IN_PDF:
'selection_procedure_pdf_names']:
if key == 'website': if key == 'website':
details[key] = {"details": details[key], "type": ["link"]} details[key] = {"details": details[key], "type": ["link"]}
else: else:
details[key] = {"details": details[key]["details"], "type": ["list", "link"], details[key] = {"details": details[key]["details"], "type": ["list", "link"],
"link": PDF_FILES_SERVING_ENDPOINT + opening.id + "/"} "link": PDF_FILES_SERVING_ENDPOINT + opening.id + "/"}
new_key = key.replace('_', ' ') new_key = key.replace('_', ' ')
if key.endswith(' names'): if new_key.endswith(' names'):
new_key = key[:-6] new_key = new_key[:-6]
new_key = new_key.capitalize() new_key = new_key.capitalize()
newdetails[new_key] = details[key] newdetails[new_key] = details[key]
imagepath = os.path.abspath('./templates/image.png') imagepath = os.path.abspath('./templates/image.png')