Placeholder, class not getting set when tried to apply through the django\'s attrs specifier for forms.DateInput
The form is a ModelForm.
And according to th
you can simply create a HTML Datepicker Without using a fancy JAvascript Library.Here is the simple demo:
First create a dateinput field inherited from Dateinput:
class DateInput(forms.DateInput):
input_type = 'date'
And use this DateInput Field as like this :
class BookingRoomForm(ModelForm):
class Meta:
widgets = {'checkin':DateInput()}
model = BookingRoom
fields = ['checkin',]
If you're not using ModelForm,Use widget something like this :
class BookingRoomForm(ModelForm):
checkin = forms.DateField(widget=DateInput())
class Meta:
model = BookingRoom
fields = ['checkin',]
And the output will be like this : enter image description here