[Django] #24984: Staticfiles should provide a Jinja2 extension with a Jinja2 equivalent for the `{% static %}` tag

9 views
Skip to first unread message

Django

unread,
Jun 14, 2015, 5:33:02 PM6/14/15
to django-...@googlegroups.com
#24984: Staticfiles should provide a Jinja2 extension with a Jinja2 equivalent for
the `{% static %}` tag
-----------------------------------------------+------------------------
Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------------+------------------------
It's trivial to implement, but the lack of it (and the lack of
documentation for using staticfiles with Jinja2) is a major hurdle for a
new user. (Not hypothetical, just encountered such a user in IRC.)

--
Ticket URL: <https://code.djangoproject.com/ticket/24984>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 14, 2015, 5:37:57 PM6/14/15
to django-...@googlegroups.com
#24984: Staticfiles should provide a Jinja2 extension with a Jinja2 equivalent for
the `{% static %}` tag
-------------------------------------+-------------------------------------

Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by MoritzS):

I already implemented it here:
https://github.com/MoritzS/jinja2-django-tags

--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:1>

Django

unread,
Jun 14, 2015, 5:39:13 PM6/14/15
to django-...@googlegroups.com
#24984: Staticfiles should provide a Jinja2 extension with a Jinja2 equivalent for
the `{% static %}` tag
-------------------------------------+-------------------------------------

Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by MoritzS):

* cc: moritz.sichert@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:2>

Django

unread,
Jun 15, 2015, 2:34:26 AM6/15/15
to django-...@googlegroups.com
#24984: Staticfiles should provide a Jinja2 extension with a Jinja2 equivalent for
the `{% static %}` tag
-------------------------------------+-------------------------------------

Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by aaugustin):

There is some documentation
[https://docs.djangoproject.com/en/1.8/topics/templates/#django.template.backends.jinja2.Jinja2
here]. Look for "For example, you can create myproject/jinja2.py ...".

--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:3>

Django

unread,
Jun 15, 2015, 11:46:47 AM6/15/15
to django-...@googlegroups.com
#24984: Staticfiles should provide a Jinja2 extension with a Jinja2 equivalent for
the `{% static %}` tag
-------------------------------------+-------------------------------------

Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by carljm):

Ah, missed those docs; thanks Aymeric.

That code is so simple, it may be that providing a Jinja2 extension is
unnecessary. I think it would be good to at least duplicate or reference
those docs somewhere in this area:
https://docs.djangoproject.com/en/1.8/ref/contrib/staticfiles/#template-
tags (that is, in the staticfiles docs, not just in the Jinja2 backend
docs).

--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:4>

Django

unread,
Jun 15, 2015, 11:47:18 AM6/15/15
to django-...@googlegroups.com
#24984: Staticfiles docs should clarify Jinja2 equivalent for `{% static %}` tag
-------------------------------------+------------------------------------

Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by carljm):

* stage: Unreviewed => Accepted
* easy: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:5>

Django

unread,
Jun 15, 2015, 12:29:41 PM6/15/15
to django-...@googlegroups.com
#24984: Staticfiles docs should clarify Jinja2 equivalent for `{% static %}` tag
-------------------------------+------------------------------------

Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: 1.8

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* component: contrib.staticfiles => Documentation


--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:6>

Django

unread,
Jul 12, 2015, 12:04:58 PM7/12/15
to django-...@googlegroups.com
#24984: Staticfiles docs should clarify Jinja2 equivalent for `{% static %}` tag
-------------------------------+-------------------------------------
Reporter: carljm | Owner: vallarfax
Type: New feature | Status: assigned

Component: Documentation | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+-------------------------------------
Changes (by vallarfax):

* owner: nobody => vallarfax
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:7>

Django

unread,
Jul 12, 2015, 2:15:16 PM7/12/15
to django-...@googlegroups.com
#24984: Staticfiles docs should clarify Jinja2 equivalent for `{% static %}` tag
-------------------------------+-------------------------------------
Reporter: carljm | Owner: vallarfax
Type: New feature | Status: assigned
Component: Documentation | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+-------------------------------------

Comment (by vallarfax):

Work on this ticket is available here:
https://github.com/vallarfax/django/tree/ticket_24984

Added a note to the staticfiles documentation that references the
instructions for configuring and using the static template tag with
Jinja2.

--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:8>

Django

unread,
Jul 13, 2015, 7:38:55 AM7/13/15
to django-...@googlegroups.com
#24984: Staticfiles docs should clarify Jinja2 equivalent for `{% static %}` tag
-------------------------------+-------------------------------------
Reporter: carljm | Owner: vallarfax
Type: New feature | Status: closed
Component: Documentation | Version: 1.8
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"d62194a260eedd30aeea78f407032aabfde4be70" d62194a]:
{{{
#!CommitTicketReference repository=""
revision="d62194a260eedd30aeea78f407032aabfde4be70"
Fixed #24984 -- Added link to Jinja2 static tag instructions in
staticfiles docs.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:9>

Django

unread,
Jul 13, 2015, 7:38:57 AM7/13/15
to django-...@googlegroups.com
#24984: Staticfiles docs should clarify Jinja2 equivalent for `{% static %}` tag
-------------------------------+-------------------------------------
Reporter: carljm | Owner: vallarfax
Type: New feature | Status: closed
Component: Documentation | Version: 1.8
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"f8140c4679c7185878886dfc1fcf0dc4e5efce4f" f8140c4]:
{{{
#!CommitTicketReference repository=""
revision="f8140c4679c7185878886dfc1fcf0dc4e5efce4f"
[1.8.x] Fixed #24984 -- Added link to Jinja2 static tag instructions in
staticfiles docs.

Backport of d62194a260eedd30aeea78f407032aabfde4be70 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24984#comment:10>

Reply all
Reply to author
Forward
0 new messages