I can't for the life of me figure out how to get the SplitDateTimeWidget
(link to ref doc) to recognize AM/PM inputs.
I've tried both the template-style input:
widgets={'start_datetime':forms.SplitDateTimeWidget(time_format='h:i A')}
and the standard Python time inputs (suggested here):
widgets={'start_datetime':forms.SplitDateTimeWidget(time_format='%I:%M %p')}
As you could guess, start_datetime
is a DateTimeField
in my model:
start_datetime=models.DateTimeField('Start', default=datetime.now())
Nothing I do seems to get this to pass validation -- I keep getting errors in that field. Any suggestions? I've been searching now for 2 hours to no avail. I can get it to validate if I stick with 24-hour time or if I leave out the AM/PM part, but I'd rather be able to correctly interpret AM/PM.
Thanks