Reputation: 187
I have a template with an input field. The input field uses a timepicker plugin which uses a format like "1:00 AM" or "4:30 PM".
In forms.py, ive tried:
timepicker = forms.TimeField(label='Time', widget=forms.TimeInput(format='%H:%M %p'
))
timepicker = forms.TimeField(label='Time', widget=forms.TimeInput(format='%I:%M %p'
))
But with both these snippets, i continue to get a input validation error that says it does not match the format.
Upvotes: 2
Views: 580
Reputation: 59274
Have you tried the following?
forms.TimeField(label='time',
input_formats=['%I:%M %p'],
widget=forms.TimeInput(format='%I:%M %p'))
Upvotes: 3