Opened 4 years ago
Closed 4 years ago
#32037 closed Bug (invalid)
MinValueValidator, MaxValueValidator comparisons are not compatible with there messages
Reported by: | MishaGubsky | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | 3.1 |
Severity: | Normal | Keywords: | MinValueValidator, MaxValueValidator, greater than or equal, less than or equal |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The standard messages for MinValueValidator and MinLengthValidator don't appropriate the logic.
@deconstructible class MaxValueValidator(BaseValidator): message = _('Ensure this value is less than or equal to %(limit_value)s.') code = 'max_value' def compare(self, a, b): return a > b class MinValueValidator(BaseValidator): message = _('Ensure this value is greater than or equal to %(limit_value)s.') code = 'min_value' def compare(self, a, b): return a < b
According to MinValueValidator and MaxValueValidator are inherited by other validators, the simplest way to fix this is to update the error message.
As an improvement will be great to have the validators without strong comparison.
Change History (2)
comment:1 by , 4 years ago
Summary: | MinValueValidator, MaxValueValidator comparison is not compatible with there messages → MinValueValidator, MaxValueValidator comparisons are not compatible with there messages |
---|
comment:2 by , 4 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
As far as I'm aware, the code is correct as is. You can check the tests.