added email option while jnf submission error
This commit is contained in:
parent
9260d121e5
commit
6a3b5042b1
|
@ -230,10 +230,12 @@ def addPlacement(request):
|
|||
status=status.HTTP_200_OK)
|
||||
|
||||
except ValueError as e:
|
||||
exception_email(opening)
|
||||
logger.info("ValueError in addPlacement: " + str(e))
|
||||
return Response({'action': "Add Placement", 'message': str(e)},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
except:
|
||||
exception_email(opening)
|
||||
logger.warning("Add New Placement: " + str(sys.exc_info()))
|
||||
return Response({'action': "Add Placement", 'message': "Something went wrong"},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
|
|
@ -331,3 +331,19 @@ def send_opening_notifications(placement_id):
|
|||
except:
|
||||
logger.warning('Utils - send_opening_notifications: ' + str(sys.exc_info()))
|
||||
return False
|
||||
|
||||
def exception_email(opening):
|
||||
data = {
|
||||
"designation": opening.designation,
|
||||
"opening_type": PLACEMENT,
|
||||
"company_name": opening.company_name,
|
||||
}
|
||||
pdfhtml = opening_description_table_html(opening)
|
||||
name = opening.company_name + '_jnf_response.pdf'
|
||||
attachment_jnf_respone = {
|
||||
"name": name,
|
||||
"html": pdfhtml,
|
||||
}
|
||||
|
||||
sendEmail(CDC_MAIl_ADDRESS, COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.id), data,
|
||||
COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone)
|
||||
|
|
Loading…
Reference in New Issue