Hi Brian, 

a sidenote, this will be fixed: 
https://github.com/django/django/pull/5571


-- 
Denis


Am Sonntag, 6. Dezember 2015 um 17:17 schrieb Brian Neal:

> I'm investigating using staticfiles ManifestStaticFilesStorage. Unless I'm 
> missing something, there seems to be a hole with Django forms Media class. If 
> you use an inner Media class you do not get the hashed versions of the assets 
> filenames. 
> 
> This leads me to believe you can't use the Forms Media technique with 
> ManifestStaticFilesStorage. 
> 
> I noticed there was an undocumented function called static in 
> staticfiles.templatetags.staticfiles. I tried calling this function inside my 
> inner Media classes to make it return the hashed version of the files, and 
> this does work as long as collectstatic has been run. But if you have an 
> empty STATIC_DIR, you can't even call the management command to run 
> collectstatic as it tries to resolve these Media classes at import time. So 
> it seems to be a chicken and egg problem. A possible work around was found on 
> stackoverflow to delay the evaluation of the Media classes: 
> http://stackoverflow.com/questions/28366281/django-cachedstaticfilesstorage-in-modeladmin-media
> 
> So it seems I have a couple of options:
> 
> 1) Give up on form Media classes and explicitly use {% static %} in my 
> templates instead of {% form.media %}
> 2) Defer the resolution of {% form.media %} using the stackoverflow trick
> 
> Since I'm not doing any dynamic decision making in my views about what forms 
> to use (yet), I always know what static files I need in my templates to 
> support my forms, so I'm leaning toward option 1. But just wanted to bounce 
> this off the community in case I am missing something.
> 
> Thanks. 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> (mailto:[email protected]).
> To post to this group, send email to [email protected] 
> (mailto:[email protected]).
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/39a230f1-3025-4964-b543-b7d48a0798ab%40googlegroups.com
>  
> (https://groups.google.com/d/msgid/django-users/39a230f1-3025-4964-b543-b7d48a0798ab%40googlegroups.com?utm_medium=email&utm_source=footer).
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/959931F98A184A0EAEB13881D0FBD80F%40fastmail.fm.
For more options, visit https://groups.google.com/d/optout.

Reply via email to