From 7acc7c6cf9a48c06d98feb6e3650cdd3dd975db4 Mon Sep 17 00:00:00 2001 From: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> Date: Mon, 9 Jan 2023 14:04:58 -0600 Subject: [PATCH] Fixed IndexError with Django 4.1 (https://github.com/goinnn/django-multiselectfield/pull/132) --- multiselectfield/db/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multiselectfield/db/fields.py b/multiselectfield/db/fields.py index 7d4eef6..7b54016 100644 --- a/multiselectfield/db/fields.py +++ b/multiselectfield/db/fields.py @@ -54,7 +54,7 @@ def __init__(self, *args, **kwargs): self.max_choices = kwargs.pop('max_choices', None) super(MultiSelectField, self).__init__(*args, **kwargs) self.max_length = get_max_length(self.choices, self.max_length) - self.validators[0] = MaxValueMultiFieldValidator(self.max_length) + self.validators.append(MaxValueMultiFieldValidator(self.max_length)) if self.min_choices is not None: self.validators.append(MinChoicesValidator(self.min_choices)) if self.max_choices is not None: