Opened 11 years ago

Closed 11 years ago

#20464 closed Bug (fixed)

admin list_editable displays wrong error messages

Reported by: Marc Egli Owned by: Baptiste Mispelon
Component: Forms Version: dev
Severity: Normal Keywords: admin
Cc: bmispelon@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Considering the following ModelAdmin:

class SomeModelAdmin(admin.ModelAdmin):
    list_display = ('pk', 'one', 'two')
    list_editable = ('one', 'two')

If you have errors in your form there is either Please correct the error below. or Please correct the errors below.. But this distinction is made on the count of forms having errors not on the total error count.

  • If you have one entry and manage to have errors in both fields then it uses Please correct the error below.
  • If you have two entries and you have one error in one of them it says Please correct the errors below.

Change History (5)

comment:1 by Kamu, 11 years ago

Easy pickings: set
UI/UX: set

comment:2 by Baptiste Mispelon, 11 years ago

Cc: bmispelon@… added
Triage Stage: UnreviewedAccepted

comment:3 by Baptiste Mispelon, 11 years ago

Owner: changed from nobody to Baptiste Mispelon
Status: newassigned

I'm looking into it and the issue stems from the fact that {{ formset.error }} is a list that has as many elements as the number of forms in the formset.

To fix this, I'm thinking of introducing a new method on formsets: total_error_count that would count all the actual errors.

I'll have a pull request ready soon.

comment:4 by Baptiste Mispelon, 11 years ago

Component: contrib.adminForms
Has patch: set
UI/UX: unset

comment:5 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In 1b7634a0d0e21faba71a27ae7951d7cb7aec0e49:

Fixed #20464 -- Added a total_error_count method on formsets.

Thanks to frog32 for the report and to Tim Graham for the review.

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