I'm using the HTML5 datetime-local
input type to try and get some datetime data into my database.
The ModelForm
class Meta:
looks like the following:
class Meta:
model = ScheduleEntry
fields = ['calendar', 'title', 'start', 'end', 'assets', 'users']
widgets = {
'calendar': forms.Select(attrs={
'class': 'fom-control chosen-select'
}),
'title': forms.TextInput(attrs={
'class': 'form-control'
}),
'start': forms.DateTimeInput(attrs={
'type':'datetime-local',
'class':'form-control'
}, format='%Y-%m-%dT%H:%M'),
'end': forms.DateTimeInput(attrs={
'type': 'datetime-local',
'class': 'form-control'
}, format='%Y-%m-%dT%H:%M'),
'assets': forms.SelectMultiple(attrs={
'class': 'form-control chosen-select'
}),
'users': forms.SelectMultiple(attrs={
'class': 'form-control chosen-select',
})
}
I keep failing on form validation and it's causing me to pull my hair out.This is the documentation page that shows it should work, but it looks like I'm missing something?
EDIT FOR CLARIFICATION:
The error message is for both start
and end
and it's Enter a valid date/time