Custom template variables in settings
abheist opened this issue · comments
Current behaviour
Currently, in email templates, Django host URLs are getting populated.
Better approach
If as a developer, I want to handle the email activation through front-end. Then I need to set the pass the front-end URL in templates.
The solution we can go with:
We can set the frontend URL in settings and use that in required places in the package.
The workaround is set the template variable path
in the settings as the fronted url, and ignore the protocol
and domain
in the template.
However, adding custom variables in the template would be good
To do:
- Allow to add a dictionary of key value pairs of template variables in the settings to be injected into the templates.
Example
EMAIL_TEMPLATE_VARIABLES: {
"frontend_domain": "the-frontend.com"
}
Now in the templates:
{{ protocol }}://{{ frontend_domain }}/{{ path }}/{{ token }}