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 authored and carltongibson committed Jul 13, 2018
1 parent b290d2c commit e540f28
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 @@ -191,7 +191,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 e540f28

Please sign in to comment.