﻿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
21397	forms.TypedChoiceField validation problem	Mikhail Mitrofanov	Claude Paroz	"I get ValidationError on this code:

{{{
POST_DAYS_CHOICE = (
    (7, '1 week'),
    (14, '2 weeks'),
    (30, '1 month'),
    (60, '2 months'),
    (90, '3 months'),
)

def days_to_till_date(val):
    print val
    try:
        till_date = date.today() + timedelta(int(val))
    except ValueError:
        till_date = date.today() + timedelta(30)
    return till_date

class PostForm(forms.ModelForm):
    till_date = forms.TypedChoiceField(label='Period', choices=POST_DAYS_CHOICE, coerce=days_to_till_date, required=True, initial=30)

}}}

This is was removed from TypedChoiceField class:

{{{
    def validate(self, value):
        pass
}}}
"	Bug	closed	Forms	1.6	Normal	fixed			Ready for checkin	1	0	0	0	0	0
