There are two ways in which you can solve this. In your ModelForm
:
- either exclude that field.
- or set it to
required=False
.
Way #1:
class MyForm(forms.ModelForm):
model = MyModel
exclude = ['field']
Way #2:
class MyForm(forms.ModelForm):
model = MyModel
field = forms.Charfield(required=False)
Which way is better?
If you do not want that field
to be editable, you should go with way #1. But if you want this field to be editable but not required, go with way #2.