Opened 9 years ago
Closed 9 years ago
#26107 closed New feature (fixed)
Add an option to int_list_validator to allow negative integers
Reported by: | Brandon Cooper | Owned by: | Akshesh Doshi |
---|---|---|---|
Component: | Core (Other) | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The CommaSeparatedIntegerField model-type doesn't allow negative number. https://docs.djangoproject.com/en/1.9/ref/models/fields/#commaseparatedintegerfield
If passing in '-3', it would return a validation error. Seems like this shouldn't be the case.
Change History (7)
comment:1 by , 9 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Someday/Maybe |
Type: | Bug → New feature |
comment:3 by , 9 years ago
Summary: | CommaSeparatedIntegerField doesn't allow negative integers → Add an option to int_list_validator to allow negative integers |
---|---|
Triage Stage: | Someday/Maybe → Accepted |
comment:4 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 9 years ago
Patch needs improvement: | unset |
---|
Don't forget to ticket the appropriate flags so the ticket appears in the "Patches needing review" queue.
Note:
See TracTickets
for help on using tickets.
I see you've sent a PR.
I don't think we can make that change as proposed due to backwards compatibility. Anyone relying on a list of positive values needs a way to keep the old behavior. Alternatively, and probably preferred for backwards compatibility, the new behavior should be opt-in. Make it an option of the validator seems okay, however, instead of also adding that option to
CommaSeparatedIntegerField
, I've proposed deprecating it.