Issue #131 new

dashboard.html

Anonymous created an issue

Hello,

In "dashboard.html" template, line 32 when is added an external JS file, like "http://www.google.com/jsapi" it is rendered in this way "/static/http://www.google.com/jsapi".

I dont know how django do, but they identidy that is an external content when renderig media an not add the static prefix.

    class Media:
        css = ('css/admin_dashboard.css',)
        js = ('http://www.google.com/jsapi',)

With this code in template it's impossible to add an external content.

        }{% for js in dashboard.Media.js %},
        {
            src : '{{ media_url }}/{{ js }}',
            test: function() { return true; }
        }{% endfor %}

Comments (1)

  1. transitdk

    IMHO, I would use static instead of media_url in the template. You could probably, do something like this.

            }{% for js in dashboard.Media.js %},
            {
                {% if 'http' in js|lower|slice:":4" %}
                src : '{{ js }}',
                {% else %}
                src : '{% static js %}',
                {% endif %}
                test: function() { return true; }
            }{% endfor %}
    

    And don't forget to have {% load staticfiles %} in the template.

    • I didn't try above, but I assume it should work
  2. Log in to comment