send email when application is created/edited by admin
This commit is contained in:
parent
ca68276738
commit
f14d4bae8d
|
@ -139,3 +139,4 @@ dmypy.json
|
|||
/CDC_Backend/Storage/
|
||||
.idea
|
||||
*.pyc
|
||||
dev.env
|
||||
|
|
|
@ -199,6 +199,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])
|
||||
user = get_object_or_404(User, pk=data[STUDENT_ID])
|
||||
|
||||
if data[APPLICATION_ID] == "":
|
||||
application = PlacementApplication()
|
||||
|
@ -216,7 +217,14 @@ 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)),
|
||||
}
|
||||
application.save()
|
||||
sendEmail(user.email, STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT, data, STUDENT_APPLICATION_SUBMITTED_TEMPLATE)
|
||||
return Response({'action': "Add Student Application", 'message': "Application added"},
|
||||
status=status.HTTP_200_OK)
|
||||
else:
|
||||
|
@ -235,7 +243,14 @@ 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",
|
||||
"additional_info": dict(json.loads(application.additional_info)),
|
||||
}
|
||||
application.save()
|
||||
sendEmail(user.email, STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT, data, STUDENT_APPLICATION_UPDATED_TEMPLATE)
|
||||
return Response({'action': "Add Student Application", 'message': "Application updated"},
|
||||
status=status.HTTP_200_OK)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue