I am giving this validation rule in my django forms, so when the field is none then it will rasie validation error but validationcoming ervey time , i meant when is none or not none i am getting the validationerror every time, How i solve this issue. models.py
class Check(models.Model):
use_for_car = models.BooleanField(default=False)
Forms.py
class CheckForm(forms.ModelForm):
translated_names = TranslationField()
def clean(self):
cleaned_data = super(CheckForm, self).clean()
use_for_car = self.cleaned_data.get("use_for_car")
if use_for_car is None:
raise ValidationError("Use For Car NEED TO BE FILLED ")
return use_for_registrations
class Meta:
fields = "__all__"
model = models.Check