Incorrect styles inclusion in templates/admin/index.html on Django 1.4

Create issue
Issue #1431 resolved
Jonathan Stoppani created an issue

When installing the dev version under Django 1.4, the admin site is lacking a stylesheet.

The culprit is the overridden admin/index.html template which includes the admin/css/dashboard.css stylesheet using the deprecated admin_media_prefix template tag (see https://bitbucket.org/chris1610/satchmo/src/dcf713d66cf3/satchmo/apps/satchmo_store/shop/templates/admin/index.html#cl-4).

The code should be updated to use the new static template tag as in https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/index.html#L4

Comments (7)

  1. Jonathan Stoppani reporter

    What about the following (not so clean) conditional switch?

    {% if STATIC_URL %}
    {% load static %}{% static "admin/css/dashboard.css" %}
    {% else %}
    {% load adminmedia %}{% admin_media_prefix %}css/dashboard.css
    {% endif %}
    
  2. Jonathan Stoppani reporter

    This broke again in Django 1.5. Seems like STATIC_URL was removed from the context.

  3. Jonathan Stoppani reporter

    ...and that's not the only change, the url template tag has to be updated to the new syntax as well.

    Edit: As there is much more to be changed to be compatible with Django 1.5, I don't know if you want to keep this open or group everything in a single "Django 1.5 compatibility" ticket.

  4. Log in to comment