django_ufilter.fields module¶
- class django_ufilter.fields.MultipleValuesField(child=None, min_values=2, max_values=None, many_validators=None, delimiter=',', all_valid=True, *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.all_valid (bool, optional) – When
False
, if any specific item does not pass validation it is ignored without failing complete field validation. Default isTrue
which enforces validation for all items.
- 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.