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
This commit is contained in:
Jannis Leidel 2011-05-07 16:58:35 +00:00
parent 4d039d8d05
commit 032b4ab5df
2 changed files with 8 additions and 8 deletions

View File

@ -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 File

@ -128,7 +128,7 @@ class ListFiltersTests(TestCase):
# 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 @@ class ListFiltersTests(TestCase):
# 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 @@ class ListFiltersTests(TestCase):
# 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 @@ class ListFiltersTests(TestCase):
# 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 @@ class ListFiltersTests(TestCase):
# 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 @@ class ListFiltersTests(TestCase):
# 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 @@ class ListFiltersTests(TestCase):
# 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')