refractored code, renamed columns in pdf attachment
This commit is contained in:
parent
8c474e5c45
commit
0a63fb0030
|
@ -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}'
|
||||||
|
|
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue