diff --git a/django/contrib/admin/filters.py b/django/contrib/admin/filters.py
index c1fc979..b2b86ce 100644
a
|
b
|
class FieldListFilter(ListFilter):
|
110 | 110 | def __init__(self, field, request, params, model, model_admin, field_path): |
111 | 111 | self.field = field |
112 | 112 | self.field_path = field_path |
113 | | self.title = field_path |
| 113 | if hasattr(field, 'verbose_name') and field.verbose_name != u'': |
| 114 | self.title = field.verbose_name |
| 115 | else: |
| 116 | # This could be, for example, a RelatedObject. |
| 117 | self.title = field_path |
114 | 118 | super(FieldListFilter, self).__init__(request, params, model, model_admin) |
115 | 119 | |
116 | 120 | def has_output(self): |
diff --git a/tests/regressiontests/admin_filters/tests.py b/tests/regressiontests/admin_filters/tests.py
index 7717984..f5542dd 100644
a
|
b
|
class ListFiltersTests(TestCase):
|
128 | 128 | |
129 | 129 | # Make sure the correct choice is selected |
130 | 130 | filterspec = changelist.get_filters(request)[0][4] |
131 | | self.assertEqual(force_unicode(filterspec.title), u'date_registered') |
| 131 | self.assertEqual(force_unicode(filterspec.title), u'date registered') |
132 | 132 | choice = select_by(filterspec.choices(changelist), "display", "Today") |
133 | 133 | self.assertEqual(choice['selected'], True) |
134 | 134 | self.assertEqual(choice['query_string'], '?date_registered__day=%s' |
… |
… |
class ListFiltersTests(TestCase):
|
150 | 150 | |
151 | 151 | # Make sure the correct choice is selected |
152 | 152 | filterspec = changelist.get_filters(request)[0][4] |
153 | | self.assertEqual(force_unicode(filterspec.title), u'date_registered') |
| 153 | self.assertEqual(force_unicode(filterspec.title), u'date registered') |
154 | 154 | choice = select_by(filterspec.choices(changelist), "display", "This month") |
155 | 155 | self.assertEqual(choice['selected'], True) |
156 | 156 | self.assertEqual(choice['query_string'], '?date_registered__month=%s' |
… |
… |
class ListFiltersTests(TestCase):
|
170 | 170 | |
171 | 171 | # Make sure the correct choice is selected |
172 | 172 | filterspec = changelist.get_filters(request)[0][4] |
173 | | self.assertEqual(force_unicode(filterspec.title), u'date_registered') |
| 173 | self.assertEqual(force_unicode(filterspec.title), u'date registered') |
174 | 174 | choice = select_by(filterspec.choices(changelist), "display", "This year") |
175 | 175 | self.assertEqual(choice['selected'], True) |
176 | 176 | self.assertEqual(choice['query_string'], '?date_registered__year=%s' |
… |
… |
class ListFiltersTests(TestCase):
|
186 | 186 | |
187 | 187 | # Make sure the correct choice is selected |
188 | 188 | filterspec = changelist.get_filters(request)[0][4] |
189 | | self.assertEqual(force_unicode(filterspec.title), u'date_registered') |
| 189 | self.assertEqual(force_unicode(filterspec.title), u'date registered') |
190 | 190 | choice = select_by(filterspec.choices(changelist), "display", "Past 7 days") |
191 | 191 | self.assertEqual(choice['selected'], True) |
192 | 192 | self.assertEqual(choice['query_string'], '?date_registered__gte=%s' |
… |
… |
class ListFiltersTests(TestCase):
|
349 | 349 | |
350 | 350 | # Make sure the correct choice is selected |
351 | 351 | filterspec = changelist.get_filters(request)[0][3] |
352 | | self.assertEqual(force_unicode(filterspec.title), u'is_best_seller') |
| 352 | self.assertEqual(force_unicode(filterspec.title), u'is best seller') |
353 | 353 | choice = select_by(filterspec.choices(changelist), "display", "No") |
354 | 354 | self.assertEqual(choice['selected'], True) |
355 | 355 | self.assertEqual(choice['query_string'], '?is_best_seller__exact=0') |
… |
… |
class ListFiltersTests(TestCase):
|
363 | 363 | |
364 | 364 | # Make sure the correct choice is selected |
365 | 365 | filterspec = changelist.get_filters(request)[0][3] |
366 | | self.assertEqual(force_unicode(filterspec.title), u'is_best_seller') |
| 366 | self.assertEqual(force_unicode(filterspec.title), u'is best seller') |
367 | 367 | choice = select_by(filterspec.choices(changelist), "display", "Yes") |
368 | 368 | self.assertEqual(choice['selected'], True) |
369 | 369 | self.assertEqual(choice['query_string'], '?is_best_seller__exact=1') |
… |
… |
class ListFiltersTests(TestCase):
|
377 | 377 | |
378 | 378 | # Make sure the correct choice is selected |
379 | 379 | filterspec = changelist.get_filters(request)[0][3] |
380 | | self.assertEqual(force_unicode(filterspec.title), u'is_best_seller') |
| 380 | self.assertEqual(force_unicode(filterspec.title), u'is best seller') |
381 | 381 | choice = select_by(filterspec.choices(changelist), "display", "Unknown") |
382 | 382 | self.assertEqual(choice['selected'], True) |
383 | 383 | self.assertEqual(choice['query_string'], '?is_best_seller__isnull=True') |