Django Book 翻译
菜单>:
TOC
返回
原文:
.. table:: Table F-1. Variables Available Inside {% for %}Loops +-----------------------+---------------------------------------------------------+ |Variable |Description | +=======================+=========================================================+ |``forloop.counter`` |The current iteration of the loop (1-indexed). | +-----------------------+---------------------------------------------------------+ |``forloop.counter0`` |The current iteration of the loop (0-indexed). | +-----------------------+---------------------------------------------------------+ |``forloop.revcounter`` |The number of iterations from the end of the loop | | |(1-indexed). | +-----------------------+---------------------------------------------------------+ |``forloop.revcounter0``|The number of iterations from the end of the loop | | |(0-indexed). | +-----------------------+---------------------------------------------------------+ |``forloop.first`` |``True`` if this is the first time through the loop. | +-----------------------+---------------------------------------------------------+ |``forloop.last`` |``True`` if this is the last time through the loop. | +-----------------------+---------------------------------------------------------+ |``forloop.parentloop`` |For nested loops, this is the loop above the current one.| +-----------------------+---------------------------------------------------------+
翻译:
.. table:: 表F-1. {% for %}循环中的可用变量 +-----------------------+---------------------------------------------------------+ |变量名 |描述 | +=======================+=========================================================+ |``forloop.counter`` |当前循环次数(索引最小为1)。 | +-----------------------+---------------------------------------------------------+ |``forloop.counter0`` |当前循环次数 (索引最小为0)。 | +-----------------------+---------------------------------------------------------+ |``forloop.revcounter`` |剩余循环次数 (索引最小为1)。 | +-----------------------+---------------------------------------------------------+ |``forloop.revcounter0``|剩余循环次数 (索引最小为0)。 | +-----------------------+---------------------------------------------------------+ |``forloop.first`` |第一次循环时为 ``True`` 。 | +-----------------------+---------------------------------------------------------+ |``forloop.last`` |最后一次循环时为 ``True`` 。 | +-----------------------+---------------------------------------------------------+ |``forloop.parentloop`` |用于嵌套循环,表示当前循环外层的循环。 | +-----------------------+---------------------------------------------------------+
备注:
译者: