improvements to email templates
This commit is contained in:
@@ -29,6 +29,7 @@ class CompanyViewSet(viewsets.ModelViewSet):
|
||||
"""
|
||||
Send email to company.creator
|
||||
"""
|
||||
# TODO: check access for anonymous users, and customize response
|
||||
|
||||
queryset = self.get_custom_queryset(request)
|
||||
instance = queryset.filter(pk=kwargs['pk']).first()
|
||||
@@ -36,6 +37,7 @@ class CompanyViewSet(viewsets.ModelViewSet):
|
||||
data = json.loads(request.body)
|
||||
# send email to manager
|
||||
message = render_to_string('company_contact.html', {
|
||||
'company': instance,
|
||||
'user': request.user,
|
||||
'data': data,
|
||||
})
|
||||
@@ -45,11 +47,15 @@ class CompanyViewSet(viewsets.ModelViewSet):
|
||||
|
||||
# send confirmation email to user
|
||||
message = render_to_string('confirm_company_contact.html', {
|
||||
'company': instance,
|
||||
'user': request.user,
|
||||
'data': data,
|
||||
})
|
||||
email = EmailMessage(subject, message, to=[request.user.email])
|
||||
email.send()
|
||||
logging.info(f"Confirmation email sent to {request.user.email}")
|
||||
logging.info(f"contact Confirmation email sent to {request.user.email}")
|
||||
|
||||
# TODO: create statslog instance to rgister interaction
|
||||
|
||||
return Response(data=data)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user