'Django - Form Validation Error not showing on Boolean Field

Not sure why, but no form validation error is showing on the below code.

The form (when the condition of the error is met) doesn't save (which is fine), but there is not validation message on the form?

FORM

   def clean_p45_boolean(self):
        p45_boolean = self.cleaned_data['p45_boolean']
        if p45_boolean == False:
            raise forms.ValidationError(_("Please attach your latest P45."))
        return p45_boolean

TEMPLATE

I've included both errors and nonfield errors

            <!-- Error -->
            <div class="field">
                {% for error in employment_employee_form.p45_boolean.errors %}
                    <p class="help is-danger">
                        {{error}}
                    </p>
                {% endfor %}
            </div>

            <!-- Non Field Errors -->
            <div class="field">
            {% if employment_employee_form.non_field_errors %}
                <p class="help is-danger">
                    {{employment_employee_form.non_field_errors}}
                </p>
            {% endif %}
            </div>

MODEL

# U.K. EMPLOYEE PAYE MODEL

class UK_Employee_PAYE(models.Model):

    p45_boolean = models.BooleanField(verbose_name='Do not have a P45?', blank=False, default=False)  

              


Solution 1:[1]

Use required=False in Django form boolean field. Reference

p45_boolean = forms.BooleanField(required=False)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1