Make pdf improvements

This commit is contained in:
karthikmurakonda 2023-07-25 12:36:59 +05:30
parent 59c85fc547
commit 6642e14951
3 changed files with 13 additions and 8 deletions

View File

@ -153,10 +153,11 @@ STUDENT_SELECTED = "student_selected"
EXCLUDE_IN_PDF = ['id', 'is_company_details_pdf', 'offer_accepted', 'is_description_pdf', EXCLUDE_IN_PDF = ['id', 'is_company_details_pdf', 'offer_accepted', 'is_description_pdf',
'is_compensation_details_pdf', 'is_selection_procedure_details_pdf', 'is_compensation_details_pdf', 'is_selection_procedure_details_pdf',
'email_verified', 'created_at'] 'email_verified', 'created_at', 'changed_by', 'is_stipend_description_pdf']
SPECIAL_FORMAT_IN_PDF = ['website', 'company_details_pdf_names', 'description_pdf_names', SPECIAL_FORMAT_IN_PDF = ['website', 'company_details_pdf_names', 'description_pdf_names',
'compensation_details_pdf_names', 'compensation_details_pdf_names',
'selection_procedure_details_pdf_names'] 'selection_procedure_details_pdf_names',
'stipend_description_pdf_names']
COMPANY_OPENING_ERROR_TEMPLATE = "Alert! Error submitting opening for {company_name}." COMPANY_OPENING_ERROR_TEMPLATE = "Alert! Error submitting opening for {company_name}."
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"
@ -205,10 +206,10 @@ SEASONS = (
) )
SEASON_CHOICES = ( SEASON_CHOICES = (
['summer', 'Summer'], ['Summer', 'Summer'],
['winter', 'Winter'], ['Winter', 'Winter'],
['autumn', 'Autumn'], ['Autumn', 'Autumn'],
['spring', 'Spring'], ['Spring', 'Spring'],
) )
FACILITIES_CHOICES = [ FACILITIES_CHOICES = [

View File

@ -316,10 +316,13 @@ def verify_recaptcha(request):
def opening_description_table_html(opening): def opening_description_table_html(opening):
# check typing of opening # check typing of opening
type = ""
if isinstance(opening, Placement): if isinstance(opening, Placement):
type = "Job"
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=EXCLUDE_IN_PDF) exclude=EXCLUDE_IN_PDF)
elif isinstance(opening, Internship): elif isinstance(opening, Internship):
type = "Internship"
details = model_to_dict(opening, fields=[field.name for field in Internship._meta.fields], details = model_to_dict(opening, fields=[field.name for field in Internship._meta.fields],
exclude=EXCLUDE_IN_PDF) exclude=EXCLUDE_IN_PDF)
# check typing of opening is query dict # check typing of opening is query dict
@ -344,7 +347,8 @@ def opening_description_table_html(opening):
imagepath = os.path.abspath('./templates/image.png') imagepath = os.path.abspath('./templates/image.png')
data = { data = {
"data": newdetails, "data": newdetails,
"imgpath": imagepath "imgpath": imagepath,
"type": type
} }
return render_to_string(COMPANY_JNF_RESPONSE_TEMPLATE, data) return render_to_string(COMPANY_JNF_RESPONSE_TEMPLATE, data)

View File

@ -31,7 +31,7 @@
<header style="background-color: #334878;"><img style="height: 3cm; margin: auto; display: block; padding: 0.5cm;" <header style="background-color: #334878;"><img style="height: 3cm; margin: auto; display: block; padding: 0.5cm;"
src='{{ imgpath }}' alt="cdc logo"></header> src='{{ imgpath }}' alt="cdc logo"></header>
<h1 style="text-align: center;"> Job Notification Form Response</h1> <h1 style="text-align: center;"> {{type}} Notification Form Response</h1>
<table id="details_table"> <table id="details_table">
{% for key, value in data.items %} {% for key, value in data.items %}
<tr> <tr>