-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Django's {% empty %} in for-loops #395
Labels
Comments
I think I would rather wrap the forloop in a if rather than add the |
Wrapping the <ul>
{% if athlete_list is defined and athlete_list|length > 0 %}
{% for athlete in athlete_list %}
<li>{{ athlete.name }}</li>
{% endfor %}
{% else %}
<li>Sorry, no athletes in this list.</li>
{% endif %}
</ul> For my taste, this is too much boilerplate code in the template. |
I'll take a PR for it |
Keats
pushed a commit
that referenced
this issue
Jul 5, 2019
* Fixed trait objects without an explicit are deprecated * Added {% else %} tag to for loops triggered in cases where the container being looped over is empty * Made for-loops over undefined variables with explicitly defined {% else %} clauses act the same as iteration over empty containers: it renders the contents of the {% else %} block. * rustfmt * Cleaned up deep if block * Code cleanup * Unified closing statement in render_for_loop Removed corner case for undefined containers in implementation of for-loop {% else %} block Removed error test for above corner case
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am missing support for an
{% empty %}
statement in for-loops. I know the{% empty %}
statement from Django's templating language:The text was updated successfully, but these errors were encountered: