Opened 18 years ago
Closed 15 years ago
#2871 closed defect (worksforme)
DateTime fields are not checked when updating object
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I created an object, but after that I updated it in Django admin and edited DateTimeField to 2006-02-31 00:00:00. In database there is 0000-00-00 00:00:00, and I get an exception when refering to object:
ValueError at /games/game/1/ year is out of range Request Method: POST Request URL: http://localhost:8000/games/game/1/ Exception Type: ValueError Exception Value: year is out of range Exception Location: /usr/lib/python2.4/site-packages/MySQLdb/connections.py in defaulterrorhandler, line 33
Please verify that the date is correct before inserting/updating. See function time.strptime in Python.
Also IntegerField (and PositiveIntegerField) is not checked but simply substituted by database to 231-1 if larger during inserting/updating.
Change History (3)
comment:1 by , 18 years ago
Component: | Validators → Admin interface |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 18 years ago
Yeah, this is something we need to catch at the form validation stage. Might be worth working up a torture test of cases where MySQL will corrupt incoming data without raising an error, and running newforms through it.
comment:3 by , 15 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I just tested it, form was validated correctly.
This should be caught by validation. Probably this will fix itself with the newforms-branch