#11681 closed (fixed)
HTML validation failure in admin/change_form.html because of errorlist ul
| Reported by: | Owned by: | Natalia Bidart | |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The admin app's change form fails to validate if there are model errors. This happens because {% if errors %} passes, but then (at least in this case) there is nothing in adminform.form.non_field_errors, so an empty <ul> is produced. The attached patch fixes it for me.
Attachments (2)
Change History (10)
by , 16 years ago
| Attachment: | errorlist.diff added |
|---|
comment:1 by , 16 years ago
| Patch needs improvement: | set |
|---|
comment:2 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 16 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
Actually, I think this problem is a bit different. non_field_errors is already a properly HTML formatted list, so there is no need to add the HTML tags in the change_form.html template.
by , 16 years ago
| Attachment: | patch-11681.diff added |
|---|
Removing surronding HTML tags for non_field_errors and for non_form_errors
comment:4 by , 16 years ago
| Patch needs improvement: | unset |
|---|
comment:5 by , 16 years ago
| milestone: | → 1.2 |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
Better use something like
{% if adminform.form.non_field_errors %} <ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul> {% endif %}than two additional checks every iteration.