Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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: UI/UX:


class WInfo(models.Model):
    city = models.CharField(max_length=1, default='A')
    w_date = models.DateField()
    def __unicode__(self):
        return str(

In the admin site, I fail to add a record. After I modify SplitDateTimeWidget.decompress, it's OK.


class SplitDateTimeWidget(MultiWidget):
    def decompress(self, value):
        if value:
            #return [, value.time().replace(microsecond=0)]
            if type(value) == 'datetime':
                return [, value.time().replace(microsecond=0)]
            if type(value) == 'date':
                return [value, None]            
        return [None, None]

Change History (2)

comment:1 Changed 9 years ago by Ramiro Morales

Resolution: worksforme
Status: newclosed

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.

comment:2 Changed 9 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top