url_filter.fields module¶
-
class
url_filter.fields.
MultipleValuesField
(child=None, min_values=2, max_values=None, many_validators=None, delimiter=u', ', *args, **kwargs)[source]¶ Bases:
django.forms.fields.CharField
Custom Django field for validating/cleaning multiple values given in a single value separated by a delimiter.
Parameters: - child (Field, optional) – Another Django form field which should be used.
- min_values (int, optional) – Minimum number of values which must be provided. By default at least 2 values are required.
- max_values (int, optional) – Maximum number of values which can be provided. By default no maximum is enforced.
- max_validators (list, optional) – Additional validators which should be used to validate all values once split by the delimiter.
- delimiter (str, optional) – The delimiter by which the value will be split into
multiple values.
By default
,
is used.
-
clean
(value)[source]¶ Custom
clean
which first validates the value first by using standardCharField
and if all passes, it applies similar validations for each value once its split.
-
many_run_validators
(values)[source]¶ Run each validation from
many_validators
for the cleaned values.