improvements to email templates
This commit is contained in:
@@ -29,6 +29,7 @@ class CompanyViewSet(viewsets.ModelViewSet):
|
|||||||
"""
|
"""
|
||||||
Send email to company.creator
|
Send email to company.creator
|
||||||
"""
|
"""
|
||||||
|
# TODO: check access for anonymous users, and customize response
|
||||||
|
|
||||||
queryset = self.get_custom_queryset(request)
|
queryset = self.get_custom_queryset(request)
|
||||||
instance = queryset.filter(pk=kwargs['pk']).first()
|
instance = queryset.filter(pk=kwargs['pk']).first()
|
||||||
@@ -36,6 +37,7 @@ class CompanyViewSet(viewsets.ModelViewSet):
|
|||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
# send email to manager
|
# send email to manager
|
||||||
message = render_to_string('company_contact.html', {
|
message = render_to_string('company_contact.html', {
|
||||||
|
'company': instance,
|
||||||
'user': request.user,
|
'user': request.user,
|
||||||
'data': data,
|
'data': data,
|
||||||
})
|
})
|
||||||
@@ -45,11 +47,15 @@ class CompanyViewSet(viewsets.ModelViewSet):
|
|||||||
|
|
||||||
# send confirmation email to user
|
# send confirmation email to user
|
||||||
message = render_to_string('confirm_company_contact.html', {
|
message = render_to_string('confirm_company_contact.html', {
|
||||||
|
'company': instance,
|
||||||
'user': request.user,
|
'user': request.user,
|
||||||
|
'data': data,
|
||||||
})
|
})
|
||||||
email = EmailMessage(subject, message, to=[request.user.email])
|
email = EmailMessage(subject, message, to=[request.user.email])
|
||||||
email.send()
|
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)
|
return Response(data=data)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
Hola {{company.creator.full_name}}.
|
||||||
|
Estamos contactando contigo como usuario gerente de la compañina {{company.company_name}}.
|
||||||
|
|
||||||
|
Datos de usuario:
|
||||||
|
|
||||||
|
- {{user.full_name}}
|
||||||
|
- {{user.email}}
|
||||||
|
|
||||||
|
Contenido del mensaje:
|
||||||
|
{{data}}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Hola {{user.full_name}}.
|
||||||
|
Hemos enviado un email a {{company.company_name}} sobre tu petición.
|
||||||
|
|
||||||
|
Información envidada:
|
||||||
|
{{data}}
|
||||||
|
|||||||
Reference in New Issue
Block a user