Custom TemplateTags
https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/#assignment-tags
# combo_tags.py
@register.assignment_tag
def cvlist_status(cvlist):
''' Retorna True se o cvlist foi processado com erro. '''
res = cvlist.cv_lists.filter(status=False, resume_text='').first()
if res:
return True
return False# template.html
<!-- Se resume.status == False e resume_text for vazio,
retornar um icone amarelo -->
<!-- Retorna True se o cvlist foi processado com erro. -->
{% cvlist_status cvlist as status_flag %}
{% if status_flag %}
<span class="glyphicon glyphicon-info-sign text-new-yellow"></span>
{% else %}
<span>Falso</span>
{% endif %}