Code

Opened 7 years ago

Closed 7 years ago

#3220 closed defect (invalid)

List_display_links validation error is not being caught correctly

Reported by: Robert Myers <myer0052@…> Owned by: adrian
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: UI/UX:

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".

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by Robert Myers <myer0052@…>

  • Cc myer0052@… added

comment:2 Changed 7 years ago by Robert Myers <myer0052@…>

  • Resolution set to invalid
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.