change email template and email backend

This commit is contained in:
karthikmurakonda 2023-08-02 23:29:04 +05:30
parent 54a6efeb31
commit 2b734012ce
6 changed files with 19 additions and 13 deletions

View File

@ -123,9 +123,9 @@ class AdminAdmin(ExportMixin, SimpleHistoryAdmin):
@admin.register(Placement)
class Placement(AdminAdmin):
list_display = (COMPANY_NAME, CONTACT_PERSON_NAME, PHONE_NUMBER, 'tier', 'compensation_CTC', 'email_verified')
list_display = (COMPANY_NAME, CONTACT_PERSON_NAME, PHONE_NUMBER, 'tier', 'compensation_CTC', 'email_verified', 'updated_at')
search_fields = (COMPANY_NAME, CONTACT_PERSON_NAME)
ordering = (COMPANY_NAME, CONTACT_PERSON_NAME, 'tier', 'compensation_CTC')
ordering = ('updated_at', COMPANY_NAME, CONTACT_PERSON_NAME, 'tier', 'compensation_CTC')
list_filter = ('tier',)
@ -195,7 +195,7 @@ class InternAdmin(ExportMixin, SimpleHistoryAdmin):
@admin.register(Internship)
class Placement(InternAdmin):
list_display = (COMPANY_NAME, CONTACT_PERSON_NAME, PHONE_NUMBER, 'stipend', 'email_verified')
list_display = (COMPANY_NAME, CONTACT_PERSON_NAME, PHONE_NUMBER, 'stipend', 'email_verified', 'updated_at')
search_fields = (COMPANY_NAME, CONTACT_PERSON_NAME)
ordering = (COMPANY_NAME, CONTACT_PERSON_NAME, 'stipend', )
ordering = ('updated_at', COMPANY_NAME, CONTACT_PERSON_NAME, 'stipend')

View File

@ -221,7 +221,8 @@ def addPlacement(request):
raise RuntimeError("Error in generating one time verification link for placement")
data = {
"designation": opening.designation,
"one_time_link": link
"one_time_link": link,
"opening_type": "Job"
}
sendEmail(opening.email, COMPANY_EMAIl_VERIFICATION_TEMPLATE_SUBJECT, data,
@ -480,7 +481,8 @@ def addInternship(request):
raise RuntimeError("Error in generating one time verification link for internship")
data = {
"designation": internship.designation,
"one_time_link": link
"one_time_link": link,
"opening_type": "Internship"
}
sendEmail(internship.email, COMPANY_EMAIl_VERIFICATION_TEMPLATE_SUBJECT, data,

View File

@ -162,7 +162,7 @@ SPECIAL_FORMAT_IN_PDF = ['website', 'company_details_pdf_names', 'description_pd
'stipend_description_pdf_names']
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}, {company} - Career Development Cell, IIT Dharwad"
STUDENT_APPLICATION_STATUS_TEMPLATE_SUBJECT = 'Application Status - {company_name} - {id}'
STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted - {company_name}'
STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT = 'CDC - Application Updated - {company_name}'

View File

@ -465,7 +465,7 @@ def send_email_for_opening(opening):
emails = [opening.email, CDC_MAIl_ADDRESS]
# Send the email
sendEmail(emails,
COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.id), data,
COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.designation, company=opening.company_name), data,
COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone)
except Exception as e:

View File

@ -157,10 +157,14 @@ CORS_ORIGIN_WHITELIST = [
CORS_REPLACE_HTTPS_REFERER = True
CSRF_TRUSTED_ORIGINS = [ "https://cdc.iitdh.ac.in", "http://cdc.iitdh.ac.in"]
# EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = './emails'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_BACKEND = ''
if DEBUG:
# file based email backend for development
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = './test-emails'
else:
# SMTP backend for production
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587

View File

@ -44,7 +44,7 @@
<td style="padding:0 0 36px 0;color:#153643;">
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
We have received your Job Notification for {{ designation }}. Kindly verify your email by clicking <a
We have received your {{opening_type}} Notification for {{ designation }}. Kindly verify your email by clicking <a
href="{{ one_time_link }}">here</a>.
</p>
</td>