summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-04-01 21:17:54 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-04-01 21:17:54 +0000
commiteb24c7fd0c92559cef37f72bce44ca1157a6c3a9 (patch)
tree51fa712f468092ff8b57aceabc310e9952a4ca83 /django
parentd0dce0257b79cbea80098b4c043a9a5ec36d8b89 (diff)
[1.0.X] Fixed #9969: choices with options groups (added in [7977]) now work correctly in the admin with list_display and list_filter. Thanks, ramiro. Backport of r10318 from trunk; thanks, cramm.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/admin/filterspecs.py2
-rw-r--r--django/contrib/admin/templatetags/admin_list.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/django/contrib/admin/filterspecs.py b/django/contrib/admin/filterspecs.py
index fd258df6b7..6f643ee102 100644
--- a/django/contrib/admin/filterspecs.py
+++ b/django/contrib/admin/filterspecs.py
@@ -90,7 +90,7 @@ class ChoicesFilterSpec(FilterSpec):
yield {'selected': self.lookup_val is None,
'query_string': cl.get_query_string({}, [self.lookup_kwarg]),
'display': _('All')}
- for k, v in self.field.choices:
+ for k, v in self.field.flatchoices:
yield {'selected': smart_unicode(k) == self.lookup_val,
'query_string': cl.get_query_string({self.lookup_kwarg: k}),
'display': v}
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index 37cdb91c3c..c19b745300 100644
--- a/django/contrib/admin/templatetags/admin_list.py
+++ b/django/contrib/admin/templatetags/admin_list.py
@@ -205,8 +205,8 @@ def items_for_result(cl, result):
result_repr = EMPTY_CHANGELIST_VALUE
# Fields with choices are special: Use the representation
# of the choice.
- elif f.choices:
- result_repr = dict(f.choices).get(field_val, EMPTY_CHANGELIST_VALUE)
+ elif f.flatchoices:
+ result_repr = dict(f.flatchoices).get(field_val, EMPTY_CHANGELIST_VALUE)
else:
result_repr = escape(field_val)
if force_unicode(result_repr) == '':