I created my own inclusion template tag that accepts a single Update model object.
Template Tag:
@register.inclusion_tag('update_line.html') def update_line(update): return {'update': update}
update_line.html
<tr><td class="update">{{ update }}</td><td class="ack"> <img id="update-{{ update.pk }}" class="ack-img" src="{{ STATIC_URL }}img/acknowledge.png" alt="Acknowledge" /></td></tr>
The problem is that {{ STATIC_URL }} not available in the inclusion template tag template, although I use the django.core.context_processors.static context django.core.context_processors.static , so {{ STATIC_URL }} is available to all my "normal" templates that are not processed with using the inclusion template tag.
Is there a way to get STATIC_URL from my inclusion template tag template without doing something unpleasant, how to manually get it from the settings and explicitly pass it as a context variable?
dgel
source share