Opened 17 years ago

Closed 17 years ago

#3220 closed defect (invalid)

List_display_links validation error is not being caught correctly

Reported by: Robert Myers <myer0052@…> Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: minor Keywords:
Cc: myer0052@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In djaongo.core.management the list_display_links validation checks to see if list_display is used. But the check is either not working or does not stop the validation of the admin option.

Testing included in #3217

Example:

class ListDisplayLinksBadThree(models.Model):
    "Test list_display_links, must define list_display to use list_display_links."
    first_name = models.CharField(maxlength=30)
    last_name = models.CharField(maxlength=30)
    
    class Admin:
        list_display_links = ('first_name',)

Expecting error:

"admin.list_display" must be defined for "admin.list_display_links" to be used.

That error is being ignored and the resulting error is displayed:

"admin.list_display_links" refers to 'first_name', which is not defined in "admin.list_display".

Change History (2)

comment:1 by Robert Myers <myer0052@…>, 17 years ago

Cc: myer0052@… added

comment:2 by Robert Myers <myer0052@…>, 17 years ago

Resolution: invalid
Status: newclosed

This error is not really an error. The validation does not work properly because list_display is set to the default of ('str',). So even if you do not define it in your admin class list_display is always defined, so the validation_error returned is correct in this instance.

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