#18254: Add support for `as <varname>` to the staticfiles {% static %} template
tag.
-------------------------------------+--------------------
Reporter: melinath | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+--------------------
I'm in a situation where I want to prepend the current site's domain to a
static file's URL. In olden times, I would've done something like:
{{{
{% if STATIC_URL|slice:":4" != "http" %}http://{{ site.domain }}{% endif
%}{{ STATIC_URL }}path/to/file.txt
}}}
But now the standard way to do things is to use the {{{ {% static %} }}}
template tag from staticfiles, which currently has no way of assigning to
the context - which means that to accomplish the above, you would need to
write a custom template tag. Granted, that would be pretty trivial, but it
shouldn't be necessary. Having the option of {{{ {% static <path> as
<varname> %} }}} would parallel nicely with the {{{ {% url %} }}} tag and
similar.
--
Ticket URL: <https://code.djangoproject.com/ticket/18254>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.