Commit 965351e8 authored by Dan McGee's avatar Dan McGee
Browse files

Add retro_static template tag



Unfortunately {% static %} cannot interpret any context variables passed
into it, so we need to customize things in order to use it here since
our resources are sorted by year.

Signed-off-by: default avatarDan McGee <dan@archlinux.org>
parent 3e2e4d4e
from django import template
from django.contrib.staticfiles.storage import staticfiles_storage
register = template.Library()
@register.simple_tag
def retro_static(year, path):
"""Like the built-in {% static %} tag but with a little extra magic."""
full_path = "%s/%s" % (year, path)
return staticfiles_storage.url(full_path)
# vim: set ts=4 sw=4 et:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment