Skip to content

Instantly share code, notes, and snippets.

@nix1947
Created February 11, 2017 03:45
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save nix1947/c765513702e76b5b665d146a72307946 to your computer and use it in GitHub Desktop.
Save nix1947/c765513702e76b5b665d146a72307946 to your computer and use it in GitHub Desktop.
dynamically populating rows and columns of bootstrap in django template
<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 -->
@Abdulsametileri
Copy link

Thanks!!

@shafay07
Copy link

shafay07 commented Sep 5, 2019

Much Appreciated! (Y)

@sdklab007
Copy link

You saved my day! Thanks! :)

@PatrycjaModelska
Copy link

PatrycjaModelska commented Jul 18, 2020

in 2020 still .... THX!!!

@Adistar964
Copy link

Thank u so much!!!!

@Elijel
Copy link

Elijel commented Nov 6, 2020

Thanks for saving my project! 👍

@AvinashMirgal
Copy link

Thanks for the help it savesd my day

@neozhixuan
Copy link

Thank you soo much you saved my life

@yunusrf
Copy link

yunusrf commented Jun 23, 2021

Thank you very much. You saved my day!

@JackFamm
Copy link

JackFamm commented Dec 8, 2022

Man, you're a genius

@HazimAdel101
Copy link

HazimAdel101 commented Feb 2, 2024

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