I've a specific html input element that shows a calendar, it is possible to add this element to my form and be validated? i exclude the model field in my form, so when i render not be used in the form fields
class AddVisionForm(forms.ModelForm):
class Meta:
model = Visions
exclude = ('init_date',
)
My approach is to pass the post to the save method in the form: form.save(request.POST) and save the value to the instance:
def save(self, *args, **kwargs):
instance = super(AddVisionForm, self).save(commit=False)
post = args[0]
instance.init_date = post['init_date']
instance.save()
But this is causing that if a user put other values than the required date format crash the site