added review/final status to email subject
This commit is contained in:
parent
c8286778bc
commit
09813acf30
3 changed files with 10 additions and 16 deletions
|
@ -1,4 +1,4 @@
|
||||||
EMAIL_HOST_USER=reimbursinator@gmail.com
|
EMAIL_HOST_USER=accountemail@yourmail.com
|
||||||
EMAIL_HOST_PASSWORD=Frank12345
|
EMAIL_HOST_PASSWORD=accountpasswordhere
|
||||||
SUBMIT_REPORT_DESTINATION_EMAIL=rdikkala@pdx.edu
|
SUBMIT_REPORT_DESTINATION_EMAIL=to-address@yourmail.com
|
||||||
SUBMIT_REPORT_FROM_EMAIL=rdikkala@pdx.edu
|
SUBMIT_REPORT_FROM_EMAIL=from-address@yourmail.com
|
|
@ -204,15 +204,9 @@ def report_detail(request, report_pk):
|
||||||
# PUT: Submits a report to the administrator for review,
|
# PUT: Submits a report to the administrator for review,
|
||||||
# but is still allowed to make further changes
|
# but is still allowed to make further changes
|
||||||
elif request.method == 'PUT':
|
elif request.method == 'PUT':
|
||||||
# rep = Report.objects.get(id=report_pk)
|
|
||||||
# if rep.submitted:
|
|
||||||
# return JsonResponse({"message": "Cannot submit a report that has already been submitted."}, status=409)
|
|
||||||
# rep.submitted = True
|
|
||||||
# rep.save()
|
|
||||||
|
|
||||||
# Send email
|
# Send email
|
||||||
send_report_to_admin(request, report_pk)
|
send_report_to_admin(request, report_pk, status="REVIEW")
|
||||||
return JsonResponse({"message": "Report submitted for review."})
|
return JsonResponse({"message": "Request for review is submitted."})
|
||||||
|
|
||||||
# DELETE: Deletes a report from the user's account.
|
# DELETE: Deletes a report from the user's account.
|
||||||
elif request.method == 'DELETE':
|
elif request.method == 'DELETE':
|
||||||
|
@ -250,7 +244,7 @@ def finalize_report(request, report_pk):
|
||||||
r.submitted = True
|
r.submitted = True
|
||||||
r.save()
|
r.save()
|
||||||
# Send email
|
# Send email
|
||||||
send_report_to_admin(request, report_pk)
|
send_report_to_admin(request, report_pk, status="FINAL")
|
||||||
return JsonResponse({"message": "Final report submitted."})
|
return JsonResponse({"message": "Final report submitted."})
|
||||||
|
|
||||||
|
|
||||||
|
@ -400,7 +394,7 @@ def section_complete(section_pk):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def send_report_to_admin(request, report_pk):
|
def send_report_to_admin(request, report_pk, status):
|
||||||
"""
|
"""
|
||||||
Sends an email message to admin with html/txt version of report,
|
Sends an email message to admin with html/txt version of report,
|
||||||
along with file attachments. Cc sent to user.
|
along with file attachments. Cc sent to user.
|
||||||
|
@ -417,7 +411,7 @@ def send_report_to_admin(request, report_pk):
|
||||||
message = None
|
message = None
|
||||||
if params['reference_number'] == '':
|
if params['reference_number'] == '':
|
||||||
message = EmailMultiAlternatives(
|
message = EmailMultiAlternatives(
|
||||||
"{}".format(params['title']),
|
"{}: {}".format(status, params['title']),
|
||||||
msg_plain,
|
msg_plain,
|
||||||
from_email,
|
from_email,
|
||||||
[to_email],
|
[to_email],
|
||||||
|
@ -425,7 +419,7 @@ def send_report_to_admin(request, report_pk):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
message = EmailMultiAlternatives(
|
message = EmailMultiAlternatives(
|
||||||
"[RT - Request Tracker #{}] {}".format(params['reference_number'], params['title']),
|
"[{} - Request #{}] {}".format(status, params['reference_number'], params['title']),
|
||||||
msg_plain,
|
msg_plain,
|
||||||
from_email,
|
from_email,
|
||||||
[to_email],
|
[to_email],
|
||||||
|
|
BIN
back/db.sqlite3
BIN
back/db.sqlite3
Binary file not shown.
Loading…
Reference in a new issue