I created a custom that accepts a update model object
Template Tags:
@ register.includetag ('update_line.html') def update_line (update): return {'update ': Update} update_line.html : & lt; Tr & gt; & Lt; Td class = "update" & gt; {{Update}} & lt; / TD & gt; & Lt; Td square = "acc" & gt; & Lt; Img id = "update - {{update.pk}}" class = "ack-img" src = "{{STATIC_URL}} img / acknowledge.png" alt = "accept" /> & Lt; / Td> & Lt; / TR & gt;
The problem is that {{STATIC_URL}} my included template is not available in the template, even if I use the django.core I am doing Context_processors.static reference processor is therefore available for all my 'normal' templates so that {{STATIC_URL}} is not being processed through an inclusion templates tag.
Can get it?
Just after posting the question, just find out:
My included Instead of using {{STATIC_URL}} in the templates, I use tags from get_static_prefix Fixed template tag:
update_line.html :
{% load constant%} & lt; Tr & gt; & Lt; TD class = "update" & gt; {{Update}} & lt; / Td> & Lt; Td square = "acc" & gt; & Lt; Img id = "update - {{update.pk}}" class = "ack-img" src = "{% get_static_prefix%} img / acknowledge.png" alt = "accept" /> & Lt; / Td> & Lt; / TR & gt;
Update I believe this is the right way to do (DJAgro 1.5+): < / P>
update_line.html : {% load staticfiles%} & lt; Tr & gt; & Lt; Td class = "update" & gt; {{Update}} & lt; / TD & gt; & Lt; Td square = "acc" & gt; & Lt; Img id = "update - {{update.pk}}" class = "ack-img" src = "{% static 'my_app / img / acknowledge.png'%}" alt = "accept" /> & Lt; / TD & gt; & Lt; / TR & gt;
Comments
Post a Comment