Skip to content

Commit

Permalink
fix: remove existing validator
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLovesDoggo committed Jan 2, 2024
1 parent 0363d68 commit 3628571
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/utils/multiselectfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def __init__(self, *args, **kwargs):
self.min_choices = kwargs.pop("min_choices", None)
self.max_choices = kwargs.pop("max_choices", None)
super(MultiSelectField, self).__init__(*args, **kwargs)
self.validators = [v for v in self.validators if not isinstance(v, validators.MaxLengthValidator)] # remove existing MaxLengthValidator
self.max_length = get_max_length(self.choices, self.max_length)
if len(self.validators) == 0:
self.validators.append(MaxValueMultiFieldValidator(self.max_length))
Expand Down

0 comments on commit 3628571

Please sign in to comment.