25👍
For clarity purposes, I would try to limit yourself to a maximum numbers of characters per line. This makes reading the render_to_string
line very hard, and makes it even harder to find errors.
from django.template.loader import render_to_string
context = {
'contact_name': contact_name,
'contact_email': contact_email,
'form_content': content
}
message = render_to_string('contact_template.txt', context,
context_instance=RequestContext(request))
It seems you are missing locations in the template where the variables are to be printed. You define the following variables:
- ‘contact_name’
- ‘contact_email’
- ‘form_content’
They are however not used in the template. Example:
Contact Name:
{{ contact_name }}
Email:
{{ contact_email }}
Content:
{{ form_content }}
Source:stackexchange.com