diff options
| author | Andy Chosak <andy@chosak.org> | 2018-10-18 19:19:56 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-10-18 19:19:56 -0400 |
| commit | 084573c7156530047bec2c19e732423fa9d0ec13 (patch) | |
| tree | 387a5431bc58fe4c3f238870ad1af2ab1b1c356d /docs | |
| parent | dc5e75d419893bde33b7e439b59bdf271fc1a3f2 (diff) | |
Updated Jinja2 static tag example to use django.templatetags.
As of cf546e11ac76c8dec527e39ff8ce8249a195ab42, this is the
canonical way to invoke the static tag.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/templates.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt index c3f9a6b5eb..8651fdeaca 100644 --- a/docs/topics/templates.txt +++ b/docs/topics/templates.txt @@ -451,7 +451,7 @@ environment. For example, you can create ``myproject/jinja2.py`` with this content:: - from django.contrib.staticfiles.storage import staticfiles_storage + from django.templatetags.static import static from django.urls import reverse from jinja2 import Environment @@ -460,7 +460,7 @@ For example, you can create ``myproject/jinja2.py`` with this content:: def environment(**options): env = Environment(**options) env.globals.update({ - 'static': staticfiles_storage.url, + 'static': static, 'url': reverse, }) return env |
