1👍
✅
You need to configure the form fields in your form class to accept your chosen date format:
start_date = forms.DateField(widget=DateInput(format='%Y%m'), input_formats=['%Y%m'])
end_date = forms.DateField(widget=DateInput(format='%Y%m'), input_formats=['%Y%m'])
(This should work in both a regular Form
and a ModelForm
).
Source:stackexchange.com