You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use the map widget and I noticed in the template {{ STATIC_URL}}. It seems that only gets added if you add django.template.context_processors.static to your context processors. The Django docs seems to suggest using the static tag which doesn't require the context processor.
So instead of: background-image: url("{{ STATIC_URL }}floppyforms/gis/img/move_vertex_on.png");
it should be: background-image: url("{% static "floppyforms/gis/img/move_vertex_on.png" %}");
with {% load static %} up at the top.
So, I guess you could leave it as, but I didn't notice anything in the docs saying that you needed to have the above mentioned context processor added for some of the default templates to work. The static tag works without any changes to settings.
The text was updated successfully, but these errors were encountered:
Yes, you are right. The {% static %} approach is prefered over the one using the context processor. floppyforms comes from an age where only {{ STATIC_URL }} existed.
We should start dropping the support for those ancient releases.
I'm happy to accept a Pull Request that changes the static use, if you like to prepare one.
I'm a little confused about compatibility with older releases... The context processor you included in your tests seems to have been added in 1.8 (looking at github, it seems they used to be in django.core.context_processors). How are the tests passing for version 1.4 - 1.7 if they're including context processors that aren't there? (I'm referring to them being referenced in tests/settings.py)
I'm trying to use the map widget and I noticed in the template
{{ STATIC_URL}}
. It seems that only gets added if you adddjango.template.context_processors.static
to your context processors. The Django docs seems to suggest using thestatic
tag which doesn't require the context processor.So instead of:
background-image: url("{{ STATIC_URL }}floppyforms/gis/img/move_vertex_on.png");
it should be:
background-image: url("{% static "floppyforms/gis/img/move_vertex_on.png" %}");
with
{% load static %}
up at the top.So, I guess you could leave it as, but I didn't notice anything in the docs saying that you needed to have the above mentioned context processor added for some of the default templates to work. The
static
tag works without any changes to settings.The text was updated successfully, but these errors were encountered: