1👍
You can either:
Override each of the boolean fields in the form
… with a boolean field that has required=True
:
class add_to_database(forms.ModelForm):
village_covered = forms.BooleanField(..., required=True)
# (repeat for other boolean fields that are required)
class Meta:
...
Or add validation functions:
class add_to_database(forms.ModelForm):
...
def clean_village_covered(self, value):
if not value:
raise forms.ValidationError("Village covered must be set")
return value
👤AKX
Source:stackexchange.com