1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Refs #30923 -- Fixed an example of rendering templates in contrib.sites docs.

This commit is contained in:
Alasdair Nicol 2019-11-05 11:41:14 +00:00 committed by Mariusz Felisiak
parent 47379d027b
commit b991eefd3a

View File

@ -218,14 +218,14 @@ different template directories (:setting:`DIRS <TEMPLATES-DIRS>`), you could
farm out to the template system like so::
from django.core.mail import send_mail
from django.template import Context, loader
from django.template import loader
def register_for_newsletter(request):
# Check form values, etc., and subscribe the user.
# ...
subject = loader.get_template('alerts/subject.txt').render(Context({}))
message = loader.get_template('alerts/message.txt').render(Context({}))
subject = loader.get_template('alerts/subject.txt').render({})
message = loader.get_template('alerts/message.txt').render({})
send_mail(subject, message, 'editor@ljworld.com', [user.email])
# ...