summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-11-17 21:30:07 +0000
committerJannis Leidel <jannis@leidel.info>2011-11-17 21:30:07 +0000
commit773d91ead2f47c3329c0c2d3745339e81d06eb4e (patch)
treeeba27d026404b0f1385ce4c4418c7018d81e9eaa /django
parentc20d33201c6eccc7f21f72bb61b1737be59b16d4 (diff)
Fixed #17128 -- Fixed a Python 2.5 incompatibility. Thanks, Simon Meers.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17102 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/admin/views/main.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py
index 616b24957a..4eed0160e2 100644
--- a/django/contrib/admin/views/main.py
+++ b/django/contrib/admin/views/main.py
@@ -221,25 +221,25 @@ class ChangeList(object):
# for ordering specified on ModelAdmin or model Meta, we don't know
# the right column numbers absolutely, because there might be more
# than one column associated with that ordering, so we guess.
- for f in ordering:
- if f.startswith('-'):
- f = f[1:]
+ for field in ordering:
+ if field.startswith('-'):
+ field = field[1:]
order_type = 'desc'
else:
order_type = 'asc'
- i = None
+ index = None
try:
# Search for simply field name first
- i = self.list_display.index(f)
+ index = list(self.list_display).index(field)
except ValueError:
- # No match, but their might be a match if we take into account
- # 'admin_order_field'
- for j, attr in enumerate(self.list_display):
- if getattr(attr, 'admin_order_field', '') == f:
- i = j
+ # No match, but there might be a match if we take into
+ # account 'admin_order_field'
+ for _index, attr in enumerate(self.list_display):
+ if getattr(attr, 'admin_order_field', '') == field:
+ index = _index
break
- if i is not None:
- ordering_fields[i] = order_type
+ if index is not None:
+ ordering_fields[index] = order_type
else:
for p in self.params[ORDER_VAR].split('.'):
none, pfx, idx = p.rpartition('-')