[2.1.x] Updated Jinja2 static tag example to use django.templatetags.
As ofcf546e11ac
, this is the canonical way to invoke the static tag. Backport of084573c715
from master.
This commit is contained in:
parent
9982babbf9
commit
822f111b86
|
@ -451,7 +451,7 @@ environment.
|
||||||
|
|
||||||
For example, you can create ``myproject/jinja2.py`` with this content::
|
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 django.urls import reverse
|
||||||
|
|
||||||
from jinja2 import Environment
|
from jinja2 import Environment
|
||||||
|
@ -460,7 +460,7 @@ For example, you can create ``myproject/jinja2.py`` with this content::
|
||||||
def environment(**options):
|
def environment(**options):
|
||||||
env = Environment(**options)
|
env = Environment(**options)
|
||||||
env.globals.update({
|
env.globals.update({
|
||||||
'static': staticfiles_storage.url,
|
'static': static,
|
||||||
'url': reverse,
|
'url': reverse,
|
||||||
})
|
})
|
||||||
return env
|
return env
|
||||||
|
|
Loading…
Reference in New Issue