Skip to content

Commit

Permalink
Allow empty values for CSV range filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan P Kilby committed Jan 16, 2018
1 parent c878eb2 commit 64791d0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion django_filters/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ class BaseRangeField(BaseCSVField):
def clean(self, value):
value = super().clean(value)

if value is not None and len(value) != 2:
assert value is None or isinstance(value, list)

if value and len(value) != 2:
raise forms.ValidationError(
self.error_messages['invalid_values'],
code='invalid_values')
Expand Down

0 comments on commit 64791d0

Please sign in to comment.