Opened 17 years ago
Closed 16 years ago
#5708 closed (invalid)
validate() returns 'This field is required.' for number fields if number is Zero
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | 0.96 |
Severity: | Keywords: | validate zero number | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
in django.db.models.fields.init.py in line 116 change:
if not self.blank and not field_data:
to
if not self.blank and field_data is None:
Change History (2)
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Model validation hasn't been fully implemented yet, and that's the only thing that should be calling
Field.validate_full()
at the moment. This will be fixed at that time.The suggested fix isn't completely correct, since, for example, an empty string isn't valid there either.
For anybody reading this in the near future, the area that needs changing is
Field.validate_full()
, which isn't line 116 any longer.