Opened 5 years ago

Closed 5 years ago

#21395 closed Bug (duplicate)

Admin widget JS files currently make <img> paths using admin_static_prefix

Reported by: rclmenezes@… Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Currently, some admin widgets create images dynamically in JS, requiring paths to files like icon-calendar.gif or selector-search.gif. Django currently accomplishes this by giving the template admin_static_prefix. Javascript then appends /img/image_path to the static prefix to create <img> tags.

This is problematic to developers who change STATICFILES_STORAGE to something like s3Boto. Some of these storage solutions require signatures or credentials to be passed as URL params for the files to be loaded.

One solution is to pass file paths for these files as parameters to DateTimeShortcuts.js and SelectFilter.js.

The admin static prefix is given to the admin base template here:

And the admin media prefix is given to SelectFilter here:

SelectFilter can be given the path to icon-unknown.gif instead of it being generated here:

And functions like addClock in DateTimeShortcuts.js can be given the path to icon-unknown.gif directly here:


Change History (2)

comment:1 Changed 5 years ago by loic84

Triage Stage: UnreviewedAccepted

I'm not too sure about the proposed solution, but I agree this problem should be addressed -- accepting the ticket on that basis.

comment:2 Changed 5 years ago by Claude Paroz

Resolution: duplicate
Status: newclosed

Duplicate of #19538

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