﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
295	[patch] Add reverse counter variables to template &#34;for loops&#34;	Clint Ecker <clintecker@…>	Adrian Holovaty	"I had a need to iterate backwards through the counter (i.e. 24,23,22,21...1) while displaying the items in a list in the proper order.  I propose the addition of forloop.counterr and forloop.counter0r variables to complement forloop.counter and forloop.counter0.

It's a simple patch and I've inlcluded it here:

{{{
--- django/core/defaulttags.py    (revision 453)
+++ django/core/defaulttags.py   (working copy)
@@ -97,6 +97,8 @@
                 # shortcuts for current loop iteration number
                 'counter0': i,
                 'counter': i+1,
+                'counterr': len(values)-i,
+                'counter0r' : len(values)-i-1,
                 # boolean values designating first and last times through loop
                 'first': (i == 0),
                 'last': (i == len_values - 1),
}}}"	defect	closed	Core (Management commands)	0.90	major	fixed			Unreviewed	1	0	0	0	0	0
