#21221: Widgets and Admin's Media should use the configured staticfiles storage 
to
create the right path to a file
-------------------------------------+-------------------------------------
     Reporter:  Guilherme Gondim     |                    Owner:  antonpp
  <semente@…>                        |
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.staticfiles  |                  Version:  1.5
     Severity:  Normal               |               Resolution:
     Keywords:  staticfiles, admin,  |             Triage Stage:  Accepted
  CachedFilesMixin, media, widgets   |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by dsanders11):

 Many of the admin forms in Django mainline get around this by manually
 using the `django.contrib.admin.templatetag.admin_static.static` template
 tag when specifying the filename, although this has disadvantages. See
 #25553 regarding the need for a lazy version of the tag since the forms
 may be imported during the app registry process and try to evaluate the
 templatetag too early (before `collectstatic` has run).

 It's also tricky to have a subclass override one of the form assets if the
 filename changes, requiring it to use the static version of the filename
 to ensure it matches in all cases.

 Off the top of my head (without thinking too deeply about it), it seems
 like the change would fit best in the rendering process for the Media
 widget? This is where the simple logic of prepending the `STATIC_URL`
 occurs so it seems logical to do the transformation here, and also leaves
 the filenames as their untransformed version up until the actual
 rendering. Specifically seems like it would fit in the `absolute_path`
 method
 [https://github.com/django/django/blob/master/django/forms/widgets.py#L80
 here].

--
Ticket URL: <https://code.djangoproject.com/ticket/21221#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/097.1deebecee80ee659d3b88f7951f3802e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to