micho
micho

Reputation: 108

Check if there is a next value in my django template for loop possible?

I'd like to check if there is a next value inside my for loop; If so set a comma if not do nothing. Is there something like an {% ifnext %}?

Upvotes: 1

Views: 174

Answers (1)

micho
micho

Reputation: 108

Quick research took me to the following solution. Assuming that we are in a forloop one could use:

{% if not forloop.last %},{% else %}{% endif %}

Upvotes: 1

Related Questions