Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#11681 closed (fixed)

HTML validation failure in admin/change_form.html because of errorlist ul

Reported by: rlaager@… 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)

errorlist.diff (822 bytes ) - added by rlaager@… 15 years ago.
patch-11681.diff (1.5 KB ) - added by Natalia Bidart 15 years ago.
Removing surronding HTML tags for non_field_errors and for non_form_errors

Download all attachments as: .zip

Change History (10)

by rlaager@…, 15 years ago

Attachment: errorlist.diff added

comment:1 by dc, 15 years ago

Patch needs improvement: set

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.

comment:2 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Natalia Bidart, 15 years ago

Owner: changed from nobody to Natalia Bidart
Status: newassigned

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 Natalia Bidart, 15 years ago

Attachment: patch-11681.diff added

Removing surronding HTML tags for non_field_errors and for non_form_errors

comment:4 by Natalia Bidart, 15 years ago

Patch needs improvement: unset

comment:5 by Alex Gaynor, 15 years ago

milestone: 1.2
Triage Stage: AcceptedReady for checkin

comment:6 by jkocherhans, 15 years ago

Resolution: fixed
Status: assignedclosed

Fixed by [12541].

comment:7 by jkocherhans, 15 years ago

(In [12542]) [1.1.X] Fixed #11681. Fixed display of non_field_errors and non_form_errors in the admin. Backport of r12541 from trunk.

comment:8 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top