[Answer]-Using required=False, still getting required field error

1👍

Assuming you are talking about a ModelForm, you cannot override the fields inside the Meta class. It must be outside.

Also, if the field is required in the model but not in the form, then you must provide a default value, like this:

class LocatorForm:
    patient_signature = forms.CharField(widget=forms.HiddenInput(), initial=" ")

    class Meta:
        ...

Alternatively, do not mention that field in the fields list and set a value by overriding the submission of the form’s POST.

👤arocks

0👍

patient_signature=forms.CharField(widget=ClientSignatureWidget(), required=False)

Leave a comment