Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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 Brendan MacDonell, 12 years ago

Has patch: set

comment:2 by Claude Paroz, 12 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Claude Paroz <claude@…>, 12 years ago

Resolution: fixed
Status: newclosed

In [ad237fb72f769bbd99b5ed6e3292bead614e1c94]:

Fixed #18724 -- Fixed IntegerField validation with value 0

comment:4 by mihaicc, 12 years ago

not fixed in (1, 4, 0, 'final', 0)

comment:5 by Claude Paroz, 12 years ago

No, it will be in 1.5

Note: See TracTickets for help on using tickets.
Back to Top