Skip to content
Myr

Merge pull request #104 from njl/fix-issue-77

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix issue #77

authored by Armin Ronacher · committed by Armin Ronacher · parents 55ea1df, 7336b7a · Browse files · 1 file+19 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+19 added−3 removed

  • other:+19 added−3 removed

1 file+19 added−3 removed

modified:docs/switching.rst+19 added-3 removed
175 unmodified lines
176177Loops178~~~~~179180For loops work very similar to Django, the only incompatibility is that in181Jinja2 the special variable for the loop context is called `loop` and not182`forloop` like in Django.180For loops work very similar to Django. Notably, in Jinja2 the special variable for 181the loop context is called `loop` and not `forloop` like in Django.182183In addition, the Django `empty` argument is called `else` in Jinja2. For example, the184Django template::185186 {% for item in items %}187 {{item}}188 {% empty %}189 No items!190 {% endfor %}191192would be handled in Flask as::193194 {% for item in items %}195 {{item}}196 {% else %}197 No items!198 {% endfor %}199200Cycle201~~~~~202203The ``{% cycle %}`` tag does not exist in Jinja because of it's implicit
55 unmodified lines