Boolean Image Flag TemplateTag

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Put this in your custom templatetags file

@register.inclusion_tag('app/boolean_flag_img.html')
def boolean_img(flag):
    return {'flag': flag}

# Use as your 'boolean_flag_img.html' file
{% if flag %}
<img src="/media/icons/accept.png" alt="True" />
{% else %}
<img src="/media/icons/deny.png" alt="False" />
{% endif %}

More like this

  1. Template Tag of Django Image Thumb Creator by ayang23 1 year, 3 months ago
  2. Safe template decorator by eternicode 1 week, 2 days ago
  3. txt2img tag to show on the web text as images by br0th3r 3 weeks, 5 days ago
  4. Cacheable resources by jbrisbin 3 years, 9 months ago
  5. email_links by sansmojo 4 years, 11 months ago

Comments

(Forgotten your password?)