Skip to main content

django_forms_rendering

Disallows using Django’s convenience form rendering helpers, for which the markup isn’t screen-reader-friendly

User impact: Serious

This rule supports the following configuration:

# Forms cannot be rendered with as_table, as_ul, or as_p
django_forms_rendering = true
# Allows as_p
django_forms_rendering = "as_p"

Success#

<!-- Good: Render a single field manually -->
<!-- django_forms_rendering = true -->
{{ form.username }}
<!-- Good: as_p can be allowed -->
<!-- django_forms_rendering = "as_p" -->
{{ form.as_p }}

Fail#

<!-- Bad: Disallows as_table -->
<!-- django_forms_rendering = true -->
{{ form.as_table }}
<!-- Bad: Disallows as_ul too -->
<!-- django_forms_rendering = true -->
{{ form.as_ul }}
<!-- Bad: Disallows as_p too -->
<!-- django_forms_rendering = true -->
{{ form.as_p }}

Resources#