#18724 closed Bug (fixed)
Model field validation for IntegerFields does not validate 0 against choices
Reported by: | Brendan MacDonell | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.4 |
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
If a model has an IntegerField
with a limited set of choices, the choices will not be checked if the model has the value zero. For instance, given the following model:
class M(models.Model): number = models.IntegerField(choices=((1, 1),))
M(number=2).full_clean()
will raise a ValidationError
, while M(number=0).full_clean()
will not.
Change History (5)
comment:1 by , 12 years ago
Has patch: | set |
---|
comment:2 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fix available at https://github.com/bremac/django/tree/ticket_18724