how can you print data in a forloop with two different cards?

I simply add some conditions so if condition statisfy than that can print.

{% for tag in tags %}
     <div class="row">
      {% if tag.id ==1 %} 
      <div class="col-md-3 col-sm-6 col-xs-12">
       <div class="photo-rounded-fluffs">
        <a href="#"> 
         <img class="img-responsive" src="{% static 'assets/img/fluffs/1.jpg'%}" alt="Image">
         <h1 class="text-center">{{tag.title}}</h1>#Here i want print tag with tag id 1
        </a> 
       </div>
      </div> 
              {% elif tag.id ==2%} 
      <div class="col-md-3 col-sm-6 col-xs-12">
       <div class="photo-rounded-fluffs">
        <a href="#">
         <img class="img-responsive" src="{% static 'assets/img/fluffs/2.jpg'%}" alt="Image">
         <h1 class="text-center">{{tag.title}}</h1> #here i want to print tag with id 2 
        </a> 
       </div>
      </div>
      {% endif %} 
     </div>
{% endfor%}```

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top