Opened 17 years ago
Closed 17 years ago
#6754 closed (wontfix)
Unclear documentation of default date/time fields values
Reported by: | kip_parker | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | models, DateTimeField, DateField, TimeField | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It wasn't clear from the documentation that date/time fieldstake a python date object as a default. I assumed that:
start = models.TimeField(default='20:00')
would be OK, but I needed
import datetime start = models.TimeField(default=datetime.datetime(2008, 1, 31, 20, 00, 00)
Note:
See TracTickets
for help on using tickets.
I'm not sure why you'd expect this to work -- would you also expect
IntegerField(default="10")
to work, too? There's nothing in the documentation that says that Django will let you be sloppy about types in this way, so I don't see how we could be clearer.