Skip to main content

Break in a Django for loop

Please consider adding a break statement in the Django for loops.

It will make possible to handle use cases like:

{% for item in deal_list %}

{% if item.amount == 5 %}

Show content

{% break %}

{% endif %]

{% endfor %}

If a requested element is found inside an if block, print it and stop loop execution.

Status: Completed1 comment

Log in to comment and vote

Comments1

  • Grzegorz Kacperski

    Team•

    Nov 24, 2022

    Hi Dawid,

    thanks for reporting. It will be added in two weeks.

    Regards,
    Grzegorz