Reputation: 655
I have a form follow as:
class UserProfileUpdateForm(forms.ModelForm):
birthday = forms.DateField(widget=forms.DateInput(attrs={"class": "datepicker input-medium"}, format=('%m/%d/%Y')),
error_messages={'required': 'Birthday is required.'})
This date picker only displays the year from 1900 to 2012. So, user can not choose a date in 2013 or the future year. Please see the picture below.
Thanks
Upvotes: 0
Views: 262
Reputation: 10827
You could change the widget to "SelectDateWidget" and specify the date range (untested here):
from django.forms.extras.widgets import SelectDateWidget
class UserProfileUpdateForm(forms.ModelForm):
birthday = forms.DateField(widget=forms.SelectDateWidget(years=range(1900, 2100),
error_messages={'required': 'Birthday is required.'})
Upvotes: 1
Reputation: 11888
This seems like a jQueryUI issue. Have you checked their docs?
$( "#datepicker" ).datepicker({
changeMonth: true,
changeYear: true
});
Should give you a good datepicker.
Upvotes: 1