﻿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
15536	ModelForm validation regression in 1.2 when using TimeField with choices	3point2	nobody	"This is my test case models.py:
{{{
from django.db import models
from django import forms


TIME_CHOICES = (
    (""09:00:00"", ""9 AM""),
    (""17:00:00"", ""5 PM"")
)

class TestModel(models.Model):
    time = models.TimeField(choices=TIME_CHOICES)


class TestForm(forms.ModelForm):
    class Meta:
        model = TestModel
}}}

This is what happens with Django 1.1.4:

{{{
>>> f = TestForm({""time"": ""09:00:00""})
>>> f.errors
{}

}}}

and this is what happens with Django 1.2.5:

{{{
>>> f = TestForm({""time"": ""09:00:00""})
>>> f.errors
{'time': [u'Value datetime.time(9, 0) is not a valid choice.']}

}}}


It looks like in 1.2 the supplied time is being converted into a datetime instance before being compared to the valid choices. It would be great to see this incompatible change from 1.1 fixed or documented."	Uncategorized	closed	Forms	1.4	Normal	invalid	blocker, regression		Accepted	0	0	0	0	0	0
