Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixes issue #77 by adding explanation to docs

Points out that the Django empty is replaced by the
Flask else.
  • Loading branch information...
commit 7336b7af6c20a811930d49e97ef1bc447e062efa 1 parent 8f0c8ee
@njl authored
Showing with 19 additions and 3 deletions.
  1. +19 −3 docs/switching.rst
22 docs/switching.rst
@@ -177,9 +177,25 @@ operator. Here are some examples::
-For loops work very similar to Django, the only incompatibility is that in
-Jinja2 the special variable for the loop context is called `loop` and not
-`forloop` like in Django.
+For loops work very similar to Django. Notably, in Jinja2 the special variable for
+the loop context is called `loop` and not `forloop` like in Django.
+In addition, the Django `empty` argument is called `else` in Jinja2. For example, the
+Django template::
+ {% for item in items %}
+ {{item}}
+ {% empty %}
+ No items!
+ {% endfor %}
+would be handled in Flask as::
+ {% for item in items %}
+ {{item}}
+ {% else %}
+ No items!
+ {% endfor %}
Please sign in to comment.
Something went wrong with that request. Please try again.