celiao / django-rest-authemail

A RESTful API for user signup and authentication using email addresses.
GNU General Public License v3.0
315 stars 92 forks source link

Pass variable to template via custom context processor #38

Closed michaellin986 closed 2 years ago

michaellin986 commented 3 years ago

I want to dynamically change the hostname of the link in the email template, so I created a custom template to handle that. I was hoping to pass the hostname to a custom context processor, which would then populate the email template. Unfortunately this doesn't seem to work, and my guess is that request is not passed into render_to_string here.

Is there a workaround (aside from creating multiple versions of the templates) or am I missing something?

celiao commented 2 years ago

Unfortunately, we don't have request defined when render_to_string() is called.

You might try modifying your project's views.py file to introduce the hostname.