Email notification from applications edits (#125)
* updater * send email when application is created/edited by admin * send email when application is created/edited by admin * fixed: email not sending when application is edit - indexed id for student. * changing subject * minor change Co-authored-by: karthikmurakonda <karthik.murakonda14@gmail.com> Co-authored-by: Gowtham Sai <66207607+gowtham3105@users.noreply.github.com>
This commit is contained in:
parent
4f18d2d540
commit
fa737c5978
|
@ -229,7 +229,7 @@ def submitApplication(request, id, email, user_type):
|
|||
data = request.data
|
||||
student = get_object_or_404(Student, pk=data[STUDENT_ID])
|
||||
opening = get_object_or_404(Placement, pk=data[OPENING_ID])
|
||||
|
||||
student_user = get_object_or_404(User, id = student.id)
|
||||
if data[APPLICATION_ID] == "":
|
||||
application = PlacementApplication()
|
||||
application.id = generateRandomString()
|
||||
|
@ -246,8 +246,16 @@ def submitApplication(request, id, email, user_type):
|
|||
else:
|
||||
additional_info[i] = data[ADDITIONAL_INFO][i]
|
||||
application.additional_info = json.dumps(additional_info)
|
||||
data = {
|
||||
"name": student.name,
|
||||
"company_name": opening.company_name,
|
||||
"application_type": "Placement",
|
||||
"additional_info": dict(json.loads(application.additional_info)),
|
||||
}
|
||||
subject = STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT.format(company_name=opening.company_name)
|
||||
application.changed_by = get_object_or_404(User, id=id)
|
||||
application.save()
|
||||
sendEmail(student_user.email, subject, data, STUDENT_APPLICATION_SUBMITTED_TEMPLATE)
|
||||
return Response({'action': "Add Student Application", 'message': "Application added"},
|
||||
status=status.HTTP_200_OK)
|
||||
else:
|
||||
|
@ -266,8 +274,17 @@ def submitApplication(request, id, email, user_type):
|
|||
additional_info[i] = data[ADDITIONAL_INFO][i]
|
||||
|
||||
application.additional_info = json.dumps(additional_info)
|
||||
data = {
|
||||
"name": student.name,
|
||||
"company_name": opening.company_name,
|
||||
"application_type": "Placement",
|
||||
"resume": application.resume[16:],
|
||||
"additional_info_items": dict(json.loads(application.additional_info)),
|
||||
}
|
||||
subject = STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT.format(company_name=opening.company_name)
|
||||
application.changed_by = get_object_or_404(User, id=id)
|
||||
application.save()
|
||||
sendEmail(student_user.email, subject, data, STUDENT_APPLICATION_UPDATED_TEMPLATE)
|
||||
return Response({'action': "Add Student Application", 'message': "Application updated"},
|
||||
status=status.HTTP_200_OK)
|
||||
else:
|
||||
|
|
|
@ -139,12 +139,14 @@ SPECIAL_FORMAT_IN_PDF = ['website', 'company_details_pdf_names', 'description_pd
|
|||
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_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted - {company_name}'
|
||||
STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT = 'CDC - Application Updated - {company_name}'
|
||||
COMPANY_EMAIl_VERIFICATION_TEMPLATE_SUBJECT = 'Email Verification - Career Development Cell, IIT Dharwad'
|
||||
|
||||
STUDENT_APPLICATION_SUBMITTED_TEMPLATE = 'student_application_submitted.html'
|
||||
COMPANY_OPENING_SUBMITTED_TEMPLATE = 'company_opening_submitted.html'
|
||||
STUDENT_APPLICATION_STATUS_SELECTED_TEMPLATE = 'student_application_status_selected.html'
|
||||
STUDENT_APPLICATION_STATUS_NOT_SELECTED_TEMPLATE = 'student_application_status_not_selected.html'
|
||||
STUDENT_APPLICATION_UPDATED_TEMPLATE = 'student_application_updated.html'
|
||||
COMPANY_EMAIL_VERIFICATION_TEMPLATE = 'company_email_verification.html'
|
||||
COMPANY_JNF_RESPONSE_TEMPLATE = 'company_jnf_response.html'
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ from .constants import *
|
|||
|
||||
class User(models.Model):
|
||||
email = models.EmailField(primary_key=True, blank=False, max_length=JNF_TEXT_MAX_CHARACTER_COUNT)
|
||||
id = models.CharField(blank=False, max_length=25)
|
||||
id = models.CharField(blank=False, max_length=25, db_index=True)
|
||||
user_type = ArrayField(models.CharField(blank=False, max_length=10), size=4, default=list, blank=False)
|
||||
last_login_time = models.DateTimeField(default=timezone.now)
|
||||
history = HistoricalRecords()
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="x-apple-disable-message-reformatting">
|
||||
<title></title>
|
||||
<!--[if mso]>
|
||||
<noscript>
|
||||
<xml>
|
||||
<o:OfficeDocumentSettings>
|
||||
<o:PixelsPerInch>96</o:PixelsPerInch>
|
||||
</o:OfficeDocumentSettings>
|
||||
</xml>
|
||||
</noscript>
|
||||
<![endif]-->
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link rel="shortcut icon" href="favicon.ico"/>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
table, td, div, h1, p {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;">
|
||||
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
|
||||
<tr>
|
||||
<td align="center" style="padding:0;">
|
||||
<table role="presentation"
|
||||
style="width:602px;border-collapse:collapse;border:1px solid #334878;border-spacing:0;text-align:left;">
|
||||
<tr>
|
||||
<td align="center" style="padding:40px 0 30px 0;background:#334878;">
|
||||
<img src="https://drive.google.com/uc?id=1QTA6dB7jnsZfU1kzyUqfD_2V5xODpWFt" alt="" width="200"
|
||||
style="height:auto;display:block;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:36px 30px 42px 30px;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
|
||||
<tr>
|
||||
<td style="padding:0 0 36px 0;color:#153643;">
|
||||
<h1 style="font-size:24px;margin:0 0 20px 0;font-family: 'Roboto', sans-serif;
|
||||
">Hello, {{ name }}</h1>
|
||||
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
|
||||
We have received some update in your application for a <b>{{ application_type }}</b> offer at
|
||||
<b>
|
||||
{{ company_name }}</b>.
|
||||
<table style="border:solid 1px; margin: auto; text-align: center;width: 80%;
|
||||
border-radius:15px; background-color: #e0e3ee">
|
||||
<tr>
|
||||
<td style="padding:8px 10px;color:#153643; "> resume:</td>
|
||||
<td style="padding:8px 10px;color:#153643;">{{ resume }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% if additional_info_items %}
|
||||
We received these additional details
|
||||
<br>
|
||||
<table style="border:solid 1px; margin: auto; text-align: center;width: 80%;
|
||||
border-radius:15px; background-color: #e0e3ee">
|
||||
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:
|
||||
'Roboto', sans-serif;text-align: center">
|
||||
{% for i,j in additional_info_items.items %}
|
||||
|
||||
<tr>
|
||||
<td style="padding:8px 10px;color:#153643; ">{{ i }}:</td>
|
||||
<td style="padding:8px 10px;color:#153643;">{{ j }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
</p>
|
||||
</p>
|
||||
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family: 'Roboto', sans-serif;">
|
||||
We will keep you informed with the updates. If you have any queries, please
|
||||
feel to
|
||||
write to
|
||||
<nobr><u>cdc.support@iitdh.ac.in</u></nobr>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:0;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
|
||||
<tr>
|
||||
<td style="width:260px;padding:0;vertical-align:top;color:#334878;">
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:30px;background:#334878;">
|
||||
<table role="presentation"
|
||||
style="width:100%;border-collapse:collapse;border:0;border-spacing:0;font-size:9px;font-family: 'Roboto', sans-serif;">
|
||||
<tr>
|
||||
<td style="padding:0;width:50%;" align="left">
|
||||
<p style="margin:0;font-size:14px;line-height:16px;font-family: 'Roboto', sans-serif;color:#ffffff;">
|
||||
® CDC,IIT Dharwad,2021<br/>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -12,7 +12,7 @@ python# CDC - Backend
|
|||
4. Install the dependencies <br>
|
||||
`pip install -r requirements.txt `
|
||||
5. Ensure that you have the PostgreSQL installed on your machine and is running on PORT **5432** <br>
|
||||
6. Make sure to give the correct database credentials in [settings.py](./CDC_Backend/CDC_Backend/settings.py)
|
||||
6. Make sure to give the correct database credentials in [settings.py](./CDC_Backend/CDC_Backend/settings.py)(https://www.youtube.com/watch?v=bE9h6aAky4s&t=193s)
|
||||
|
||||
### Running the Application
|
||||
|
||||
|
@ -28,7 +28,11 @@ python# CDC - Backend
|
|||
2. Run `python manage.py createsuperuser` to create a user to access the admin panel.
|
||||
3. Set up the Username and Password
|
||||
4. You can log in and change the database values anytime.
|
||||
|
||||
|
||||
# Error
|
||||
1.make sure that your machine time and google time are same ,if not go to setting of date and time and sync this
|
||||
2.make sure u have used same id for both student and Admin that is your iitfh roll_no
|
||||
3. same client link in .env of frontend or constants.py of bakcend
|
||||
### Deploying
|
||||
|
||||
1. Add the hosted domain name in `ALLOWED_HOSTS` in [settings.py](./CDC_Backend/CDC_Backend/settings.py)
|
||||
|
|
Loading…
Reference in New Issue