Skip to content

Commit

Permalink
Remove OrderingFilter.help_text (#757)
Browse files Browse the repository at this point in the history
* Remove confusing help text for OrderingFilter

* Add OrderingFilter/SelectMultiple incompat note
  • Loading branch information
Ryan P Kilby authored and Carlton Gibson committed Aug 9, 2017
1 parent 7f69e35 commit 22682ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions django_filters/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ def __init__(self, *args, **kwargs):
kwargs['choices'] = self.build_choices(fields, field_labels)

kwargs.setdefault('label', _('Ordering'))
kwargs.setdefault('help_text', '')
kwargs.setdefault('null_label', None)
super(OrderingFilter, self).__init__(*args, **kwargs)

Expand Down
3 changes: 2 additions & 1 deletion docs/ref/filters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,8 @@ want to disable descending sort options.

This filter is also CSV-based, and accepts multiple ordering params. The
default select widget does not enable the use of this, but it is useful
for APIs.
for APIs. ``SelectMultiple`` widgets are not compatible, given that they
are not able to retain selection order.

Adding Custom filter choices
""""""""""""""""""""""""""""
Expand Down
5 changes: 5 additions & 0 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1411,3 +1411,8 @@ def test_translation_override_label(self):
('username', 'BLABLA'),
('-username', 'BLABLA (malejąco)'),
])

def test_help_text(self):
# regression test for #756 - the ususal CSV help_text is not relevant to ordering filters.
self.assertEqual(OrderingFilter().field.help_text, '')
self.assertEqual(OrderingFilter(help_text='a').field.help_text, 'a')

0 comments on commit 22682ee

Please sign in to comment.