Hello,
I tried setting the format of a DateField using the following code:
class SetUpForm_Personal(ModelForm):
class Meta:
model = Account
fields = ['prename', 'surname', 'birthdate', 'punkte']
widgets = {
'prename': TextInput(attrs={"class": "form-control form-group", "required:": "", "placeholder": "Vorname*", "style": "max-width: 800px; margin-left: auto; margin-right: auto;"}),
'surname': TextInput(attrs={"class": "form-control dragArea col-md col-sm-12 form-group mb-3", "required:": "", "placeholder": "Nachname*", "style": "max-width: 800px; margin-left: auto; margin-right: auto;"}),
'punkte': TextInput(attrs={"class": "form-control dragArea col-md col-sm-12 form-group mb-3", "required:": "", "placeholder": "Aktien Anzahl*", "style": "max-width: 800px; margin-left: auto; margin-right: auto;"}),
'birthdate': DateField(widget=forms.DateInput(format='%d/%m/%Y', attrs={'class': 'datepicker'}), input_formats=('%d/%m/%Y', )
)
}
labels = {
'prename': (),
'surname': (),
'birthdate': (),
'punkte': (),
}
But Im getting this error:
'DateField' object has no attribute 'is_hidden'
How can I prevent this, is there a better solution?