# 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 %} {% else %} {% endif %}