#10220 closed (worksforme)
the admin site can not handle the DateField.
Reported by: | duns | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.0 |
Severity: | 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
class WInfo(models.Model): city = models.CharField(max_length=1, default='A') w_date = models.DateField() def __unicode__(self): return str(self.id)
In the admin site, I fail to add a record. After I modify SplitDateTimeWidget.decompress, it's OK.
"C:\Python25\lib\site-packages\django\forms\widgets.py"
class SplitDateTimeWidget(MultiWidget): ... def decompress(self, value): if value: #return [value.date(), value.time().replace(microsecond=0)] if type(value) == 'datetime': return [value.day(), value.time().replace(microsecond=0)] if type(value) == 'date': return [value, None] return [None, None]
Note:
See TracTickets
for help on using tickets.
I implemented your example using Django r9820 and sqlite3 and I could add a WInfo instance without problems (by entering a valid value for the w_date field).
Closing this ticket, reopen if you are willing to provide more details, for example, exact Django SVN revision or release, database backend in use (and the traceback, if any, you are getting when you say "In the admin site, I fail to add a record.") or better yet, post to the django-user mailing list.