Commits

Hynek Cernoch committed fe16a42

Fixed missing css for Django 1.4 by replacement of admin_media_prefix.

Comments (0)

Files changed (3)

livesettings/templates/livesettings/group_settings.html

 {% load i18n admin_modify config_tags %}
 {% block extrastyle %}
 {{ block.super }}
-<link rel="stylesheet" type="text/css" href="{% load adminmedia %}{% admin_media_prefix %}css/base.css" />
+<link rel="stylesheet" type="text/css" href="{{ ADMIN_MEDIA_PREFIX }}css/base.css" />
 {% endblock %}
 
-{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/forms.css{% endblock %}
+{% block stylesheet %}{{ ADMIN_MEDIA_PREFIX }}css/forms.css{% endblock %}
 {% block coltype %}colMS{% endblock %}
 {% block bodyclass %}dashboard{% endblock %}
 {% block userlinks %}<a href="{% url admin:index %}doc/">{% trans 'Documentation' %}</a> / <a href="{% url admin:index %}password_change/">{% trans 'Change password' %}</a> / <a href="{% url admin:index %}logout/">{% trans 'Log out' %}</a>{% endblock %}

livesettings/templates/livesettings/site_settings.html

 {% extends "admin/base_site.html" %}
-{% load i18n adminmedia admin_modify config_tags %}
+{% load i18n admin_modify config_tags %}
 
-{% block stylesheet %}{% admin_media_prefix %}css/forms.css{% endblock %}
+{% block stylesheet %}{{ ADMIN_MEDIA_PREFIX }}css/forms.css{% endblock %}
 {% block extrahead %}{{ block.super }}
 <script type="text/javascript" src="{% url admin:jsi18n %}"></script>
-<script type="text/javascript" src="{% admin_media_prefix %}js/core.js"></script>
+<script type="text/javascript" src="{{ ADMIN_MEDIA_PREFIX }}js/core.js"></script>
 {% if DJANGO_PRE_12 %}
-<script type="text/javascript" src="{% admin_media_prefix %}js/admin/CollapsedFieldsets.js"></script>
+<script type="text/javascript" src="{{ ADMIN_MEDIA_PREFIX }}js/admin/CollapsedFieldsets.js"></script>
 <script type="text/javascript">
 var uncollapse = function () {
     CollapsedFieldsets.uncollapse_all();
 }
 </script>
 {% else %}
-<script type="text/javascript" src="{% admin_media_prefix %}js/jquery.init.js"></script>
-<script type="text/javascript" src="{% admin_media_prefix %}js/collapse.js"></script>
+<script type="text/javascript" src="{{ ADMIN_MEDIA_PREFIX }}js/jquery.init.js"></script>
+<script type="text/javascript" src="{{ ADMIN_MEDIA_PREFIX }}js/collapse.js"></script>
 <script type="text/javascript">
 var $ = django.jQuery,
 uncollapse = function() {
 {% endblock %}
 {% block extrastyle %}
 {{ block.super }}
-<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/base.css" />
+<link rel="stylesheet" type="text/css" href="{{ ADMIN_MEDIA_PREFIX }}css/base.css" />
 <style type="text/css">
 ul.fieldref { margin: 0; padding: 0; font-size: 9px; }
 ul.fieldref li { float: left; margin: 0 10px 0 0; list-style: none; }

livesettings/views.py

+from django.conf import settings as djangosettings
 from django.contrib import messages
 from django.contrib.auth.decorators import permission_required
 from django.http import HttpResponseRedirect
 log = logging.getLogger('livesettings.views')
 
 def _pre_12():
-    ver = django.VERSION
-    return ver[0] == 1 and ver[1] < 2
+    return django.VERSION < (1, 2)
 
 @csrf_protect
 def group_settings(request, group, template='livesettings/group_settings.html'):
     else:
         form = None
 
+    if django.VERSION < (1, 4):
+        ADMIN_MEDIA_PREFIX = djangosettings.ADMIN_MEDIA_PREFIX
+    else:
+        ADMIN_MEDIA_PREFIX = djangosettings.STATIC_URL + 'admin/'
+
     return render_to_response(template, {
         'title': title,
         'group' : group,
         'form': form,
         'use_db' : use_db,
+        'ADMIN_MEDIA_PREFIX' : ADMIN_MEDIA_PREFIX,
         'DJANGO_PRE_12' : _pre_12()
     }, context_instance=RequestContext(request))
 group_settings = never_cache(permission_required('livesettings.change_setting')(group_settings))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.