﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27304	Django 1.10 onwards broke previous behaviour for models.DateTimeField() in Admin	Kegan Gan	nobody	"In Django 1.9 and prior, we can use a date widget in Admin for a `datetime` field. Specifically, we can override the default `datetime` widget in Admin using `AdminDateWidget`. In this way, user are only require to enter a ''date''. The ''time'' will be default 0h 0m 0s.

From Django 1.10 onwards, this behaviour has break. Now, there is an error `Enter a list of values.` on save in Admin.

Example code.

Model:
{{{
class Highlight(models.Model):
    end_at = models.DateTimeField()

    def save(self, *args, **kwargs):
        # Add 23 hours, 59 minutes, 59 seconds to end_at so that it represent end of day.
        extratime = timedelta(hours=23, minutes=59, seconds=59)
        if self.end_at:
            self.end_at = self.end_at + extratime
        super(Highlight, self).save(*args, **kwargs)
}}}

Admin:
{{{
class HighlightAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.DateTimeField: {'widget': widgets.AdminDateWidget},
    }
}}}

Now there is no easy way to let user only input the ''date'' part of `datetime`field  in Admin."	Bug	closed	contrib.admin	1.10	Normal	invalid	model admin datetime formfield_overrides AdminDateWidget widget		Unreviewed	0	0	0	0	0	0
