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
- icon shortcut - pseudohtml tag with attribute merging and variables resolving by wiz 2 years, 11 months ago
- Load Windows ICO files by dc 4 years, 4 months ago
- Improved many-page pagination by dokterbob 2 years, 8 months ago
- really spaceless (trim spaces at line start) by wolfram 5 years, 4 months ago
- Filter to resize a ImageField on demand by michelts 6 years, 1 month ago
Comments