Created
January 6, 2014 19:13
-
-
Save pjlamb12/8288056 to your computer and use it in GitHub Desktop.
Django template for loop and if statement
This file contains hidden or 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
{% for rank in ranks %} | |
{% if rank.person.id == person.id %} | |
<td>{{rank.get_rank_display}}</td> | |
<td>{{rank.start_date}}</td> | |
{% elif forloop.last %} | |
<td></td> | |
<td></td> | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is brilliant, looked everywhere and found it here! BIG thanks! It works flawlessly!