-1
Personal as I use a custom tag within an if tag?
ex:  {% if {%outraTag  x y z %} == "Sucesso" %}
my custom_field_tag
@register.simple_tag
def outraTag(x,y,z):
  r=x+y+z
  if r ==3:
    return "Sucesso"
  else:
    return "Errado"
						-1
Personal as I use a custom tag within an if tag?
ex:  {% if {%outraTag  x y z %} == "Sucesso" %}
my custom_field_tag
@register.simple_tag
def outraTag(x,y,z):
  r=x+y+z
  if r ==3:
    return "Sucesso"
  else:
    return "Errado"
						0
I believe you are asking about JINJA, the template language of Django. And the wish is to use a different HTML tag depending on a condition
Just use something like:
<ul>
  {% if athlete_list %}
    {% for athlete in athlete_list %}
      <li>{{ athlete.name }}</li>
    {% endfor %}
  {% else %}
    <li>Sorry, no athletes in this list.</li>
  {% endif %}
</ul>
Taken from documentation django
Just as lucky, you could use
{% if condicao %}
   <H1>
{% else %}
   <H2>
{% endif %}
   Qualquer coisa
{% if condicao %}
   </H1>
{% else %}
   </H2>
{% endif %}
This solution seems to me a little strange, but I do not know your project and can solve your question.
Browser other questions tagged html python django-templates
You are not signed in. Login or sign up in order to post.