Opened 11 years ago
Closed 11 years ago
#22160 closed Bug (needsinfo)
TimeField default argument not working.
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hello,
The problem is that i have the field definition like this:
pickup_time_from = models.TimeField(default=datetime.time(hour=9))
And when I try to validate the model through a ModelForm it give me the error that the field is required.
I also tried the following:
pickup_time_from = models.TimeField(default=datetime.time(hour=9), blank=True)
But it throws the following exception:
null value in column "pickup_time_from" violates not-null constraint
Hope this helps,
Best regards,
Vlad
Change History (2)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Aren't you confusing default
and initial
too?
Is this related to #15725?