-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(fields): append validator instead of pushing it with index error #136
Conversation
Hi, I also came to the same conclusion with this error. Don't see a reason why that value would need to be added exclusively at the zero index. |
why this PR is not approved yet?? |
Hi, I will use for my projects fixed |
Related to #134 I think your code does not cover completly the need. If max_length is set, then the It is not too much of a worry to double check but not very useful either. I would rather do this: if self.max_length is None:
self.max_length = get_max_length(self.choices, self.max_length)
self.validators.append(MaxValueMultiFieldValidator(self.max_length))
else:
self.validators[0] = MaxValueMultiFieldValidator(self.max_length) |
Dajngo 4 all ok, nothing doubled:
|
Although, we can wonder why there is a Admitting that this feature makes sense, you are checking twice : MaxValueMultiFieldValidator is a MaxLengthValidator !! class MaxValueMultiFieldValidator(validators.MaxLengthValidator):
code = 'max_multifield_value'
def clean(self, x):
return len(','.join(x)) And you can run for validator in my_field.validators:
print(validator.limit_value) To see that they are duplicates. See other PR |
Fixed in #148. |
Hello,
added compatible with Django > 4