Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #15971 -- Fixed regression introduced in r16144 that prevented …

…the use of the field's verbose_name attribute. Thanks to mk and Julien.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16171 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 032b4ab5dfc39b8166d472ae5e360f985afe2988 1 parent 4d039d8
@jezdez jezdez authored
View
2  django/contrib/admin/filters.py
@@ -110,7 +110,7 @@ class FieldListFilter(ListFilter):
def __init__(self, field, request, params, model, model_admin, field_path):
self.field = field
self.field_path = field_path
- self.title = field_path
+ self.title = getattr(field, 'verbose_name', field_path)
super(FieldListFilter, self).__init__(request, params, model, model_admin)
def has_output(self):
View
14 tests/regressiontests/admin_filters/tests.py
@@ -128,7 +128,7 @@ def test_datefieldlistfilter(self):
# Make sure the correct choice is selected
filterspec = changelist.get_filters(request)[0][4]
- self.assertEqual(force_unicode(filterspec.title), u'date_registered')
+ self.assertEqual(force_unicode(filterspec.title), u'date registered')
choice = select_by(filterspec.choices(changelist), "display", "Today")
self.assertEqual(choice['selected'], True)
self.assertEqual(choice['query_string'], '?date_registered__day=%s'
@@ -150,7 +150,7 @@ def test_datefieldlistfilter(self):
# Make sure the correct choice is selected
filterspec = changelist.get_filters(request)[0][4]
- self.assertEqual(force_unicode(filterspec.title), u'date_registered')
+ self.assertEqual(force_unicode(filterspec.title), u'date registered')
choice = select_by(filterspec.choices(changelist), "display", "This month")
self.assertEqual(choice['selected'], True)
self.assertEqual(choice['query_string'], '?date_registered__month=%s'
@@ -170,7 +170,7 @@ def test_datefieldlistfilter(self):
# Make sure the correct choice is selected
filterspec = changelist.get_filters(request)[0][4]
- self.assertEqual(force_unicode(filterspec.title), u'date_registered')
+ self.assertEqual(force_unicode(filterspec.title), u'date registered')
choice = select_by(filterspec.choices(changelist), "display", "This year")
self.assertEqual(choice['selected'], True)
self.assertEqual(choice['query_string'], '?date_registered__year=%s'
@@ -186,7 +186,7 @@ def test_datefieldlistfilter(self):
# Make sure the correct choice is selected
filterspec = changelist.get_filters(request)[0][4]
- self.assertEqual(force_unicode(filterspec.title), u'date_registered')
+ self.assertEqual(force_unicode(filterspec.title), u'date registered')
choice = select_by(filterspec.choices(changelist), "display", "Past 7 days")
self.assertEqual(choice['selected'], True)
self.assertEqual(choice['query_string'], '?date_registered__gte=%s'
@@ -349,7 +349,7 @@ def verify_booleanfieldlistfilter(self, modeladmin):
# Make sure the correct choice is selected
filterspec = changelist.get_filters(request)[0][3]
- self.assertEqual(force_unicode(filterspec.title), u'is_best_seller')
+ self.assertEqual(force_unicode(filterspec.title), u'is best seller')
choice = select_by(filterspec.choices(changelist), "display", "No")
self.assertEqual(choice['selected'], True)
self.assertEqual(choice['query_string'], '?is_best_seller__exact=0')
@@ -363,7 +363,7 @@ def verify_booleanfieldlistfilter(self, modeladmin):
# Make sure the correct choice is selected
filterspec = changelist.get_filters(request)[0][3]
- self.assertEqual(force_unicode(filterspec.title), u'is_best_seller')
+ self.assertEqual(force_unicode(filterspec.title), u'is best seller')
choice = select_by(filterspec.choices(changelist), "display", "Yes")
self.assertEqual(choice['selected'], True)
self.assertEqual(choice['query_string'], '?is_best_seller__exact=1')
@@ -377,7 +377,7 @@ def verify_booleanfieldlistfilter(self, modeladmin):
# Make sure the correct choice is selected
filterspec = changelist.get_filters(request)[0][3]
- self.assertEqual(force_unicode(filterspec.title), u'is_best_seller')
+ self.assertEqual(force_unicode(filterspec.title), u'is best seller')
choice = select_by(filterspec.choices(changelist), "display", "Unknown")
self.assertEqual(choice['selected'], True)
self.assertEqual(choice['query_string'], '?is_best_seller__isnull=True')
Please sign in to comment.
Something went wrong with that request. Please try again.