Skip to content Skip to sidebar Skip to footer

Django Forms Datetimeinput Widget- How To Specify Max Date?

I have a form displayed in my Django project, and one of the form fields is a DateTimeInput widget, defined with: presentation_date = mDateTimeField(required=False, label='Pres

Solution 1:

This should help you:

widgets = {
    'start_date': forms.DateInput(attrs={
        'class':'datepicker', 'data-min': YOUR_MIN_DATE, 
        'data-max': YOUR_MAX_DATE}),
}

Usage:

minDate: $(this).data('min'),
maxDate: $(this).data('max'),

Post a Comment for "Django Forms Datetimeinput Widget- How To Specify Max Date?"