Code

Opened 7 years ago

Closed 7 years ago

#3724 closed (invalid)

Add Links for ImageField and FileField in admin_list.py

Reported by: nicholasdsj@… Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: ImageField FileField
Cc: toke-django@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When I added ImageField or FileField to list_display_links, the result was not what I expected.

I saw the code in admin_list.py, the function items_for_result, there was no check for ImageField and FileFiled, I suggested to add following snippts:

# Line 176
            elif isinstance(f, models.ImageField) or isinstance(f, models.FileField):
                if field_val is not None:
                    result_repr = ('<a href="%s	%s">%s</a>' % (settings.MEDIA_URL, field_val, field_val))
                else:
                    result_repr = EMPTY_CHANGELIST_VALUE

I hope the django team can consider about that.

Thanks in advance.

Attachments (0)

Change History (5)

comment:1 Changed 7 years ago by toke

  • Component changed from Contrib apps to Admin interface
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

According to the docs:
"Set list_display_links to control which fields in list_display should be linked to the “change” page for an object."

So its wrong to link to the image or file itself!

comment:2 Changed 7 years ago by toke

  • Cc toke-django@… added
  • Resolution set to invalid
  • Status changed from new to closed

comment:3 Changed 7 years ago by anonymous

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:4 Changed 7 years ago by toke

After discussion at #django-sprint this ticket was closed. Why it's reopened?

comment:5 Changed 7 years ago by Michael Radziej <mir@…>

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

Without looking into the details: No anonymous reopening is permitted, and please also state a reason.

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.