Created
February 11, 2017 03:45
-
-
Save nix1947/c765513702e76b5b665d146a72307946 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 --> |
Thank you very much. You saved my day!
Man, you're a genius
I did not work in my code at the first place,
but GPT is there for help made the needed modifications.
Thanks a million
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you soo much you saved my life