-
-
Save sdklab007/ad353091e6b5a25d392a0758df9c4c4b to your computer and use it in GitHub Desktop.
dynamically populating rows and columns of bootstrap in django template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
{% for project in projects %} | |
{% if forloop.counter0|divisibleby:3 %} <div class="row text-center"> {% endif %} | |
<div class="col-md-4" onclick="window.location.href='{% url 'club:robotics_detail' project.id %}'" style="cursor: pointer"> | |
<div class="card"> | |
<img src="http://placehold.it/300X150" alt=""> | |
<div class="card-content"> | |
<br> | |
<h4>Project {{ forloop.counter }}</h4> | |
<hr> | |
<h3>{{ project.project_name }}</h3> | |
<p>{{ project.project_summary }}</p> | |
<br> | |
</div><!-- card content --> | |
</div><!-- card --> | |
</div><!-- col-md-4 --> | |
{% if forloop.counter|divisibleby:3 or forloop.last %}</div><!-- row closing --><hr>{% endif %} | |
{% endfor %} | |
</div><!-- container --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment