mirror of
https://github.com/django/django.git
synced 2025-08-01 17:42:56 +00:00
[3.0.x] Refs #30923 -- Fixed an example of rendering templates in contrib.sites docs.
Backport of b991eefd3a
from master
This commit is contained in:
parent
2cf5df1204
commit
78fc05303a
1 changed files with 3 additions and 3 deletions
|
@ -218,14 +218,14 @@ different template directories (:setting:`DIRS <TEMPLATES-DIRS>`), you could
|
||||||
farm out to the template system like so::
|
farm out to the template system like so::
|
||||||
|
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.template import Context, loader
|
from django.template import loader
|
||||||
|
|
||||||
def register_for_newsletter(request):
|
def register_for_newsletter(request):
|
||||||
# Check form values, etc., and subscribe the user.
|
# Check form values, etc., and subscribe the user.
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
subject = loader.get_template('alerts/subject.txt').render(Context({}))
|
subject = loader.get_template('alerts/subject.txt').render({})
|
||||||
message = loader.get_template('alerts/message.txt').render(Context({}))
|
message = loader.get_template('alerts/message.txt').render({})
|
||||||
send_mail(subject, message, 'editor@ljworld.com', [user.email])
|
send_mail(subject, message, 'editor@ljworld.com', [user.email])
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue