Opened 18 years ago
Closed 18 years ago
#3408 closed (worksforme)
DateField, TimeField, and DateTimeField to_python() handles null values incorrectly
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | to_python, validation, model | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
DateField, TimeField, and DateTimeField all throw errors incorrectly during serialization and validation when they have a null value even if the model specifies that a null value is acceptable. The patch included simply checks for None as the value, then either returns that value, or raises an appropriate validation error if the field cannot be null.
Attachments (2)
Change History (5)
by , 18 years ago
Attachment: | __init__.py.diff added |
---|
comment:1 by , 18 years ago
Whoops, ignore the first file.
Also, come to think of it the TimeField doesn't even have a to_python. I'm not sure why so I didn't add it here.
comment:3 by , 18 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
/django/db/models/fields/init.py