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.

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board

🧩 Feature Request

Date

Almost 4 years ago

Author

Dawid Tyburek

Subscribe to request

Get notified by email when there are changes.