summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-04-01 14:14:20 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-04-01 14:14:20 +0000
commitee17cabba0e1f2cbb85b2044eda43108e3f4371c (patch)
treefa5c3ade8c85aa0ca7cec09f9262646ab36c31a5 /django
parenta2dec37c413cc1b9fd205047e15602e4bc41de1f (diff)
Fixed #9969: choices with options groups (added in [7977]) now work correctly in the admin with list_display and list_filter. Thanks, ramiro.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10318 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 21401caf43..d97c36a207 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, form):
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) == '':