tags:

views:

20

answers:

1

I am trying to use the SelectDateWidget in a form, but it is telling me that the field is required. My model says that the DateField can be null and blank, and in the admin site, it doesn't have a problem with me leaving it blank. I am using the version of the widget from http://code.djangoproject.com/ticket/9124

Here is the code in my form:

birth_date = forms.DateField(widget=SelectDateWidget(years=range(1700, date.today().year+1), required=False))

Any ideas?

A: 

Your required=False is in the wrong place. It is inside the call to the widget, whereas actually it is a parameter to the field. Move it outside the innermost brackets.

Daniel Roseman