Ticket #11967: admin_media.diff

File admin_media.diff, 2.3 KB (added by Daniel Roseman, 15 years ago)
  • django/contrib/admin/media/js/admin/DateTimeShortcuts.js

     
    1313    clockLinkName: 'clocklink',      // name of the link that is used to toggle
    1414    admin_media_prefix: '',
    1515    init: function() {
    16         // Deduce admin_media_prefix by looking at the <script>s in the
     16        // admin_media_prefix should have been set as a global variable in the
     17        // template, but if not deduce it by looking at the <script>s in the
    1718        // current document and finding the URL of *this* module.
    18         var scripts = document.getElementsByTagName('script');
    19         for (var i=0; i<scripts.length; i++) {
    20             if (scripts[i].src.match(/DateTimeShortcuts/)) {
    21                 var idx = scripts[i].src.indexOf('js/admin/DateTimeShortcuts');
    22                 DateTimeShortcuts.admin_media_prefix = scripts[i].src.substring(0, idx);
    23                 break;
     19        if (window.admin_media_prefix == undefined) {
     20            var scripts = document.getElementsByTagName('script');
     21            for (var i=0; i<scripts.length; i++) {
     22                if (scripts[i].src.match(/DateTimeShortcuts/)) {
     23                    var idx = scripts[i].src.indexOf('js/admin/DateTimeShortcuts');
     24                    DateTimeShortcuts.admin_media_prefix = scripts[i].src.substring(0, idx);
     25                    break;
     26                }
    2427            }
     28        }
     29        else {
     30            DateTimeShortcuts.admin_media_prefix = window.admin_media_prefix;
    2531        }
    2632
    2733        var inputs = document.getElementsByTagName('input');
  • django/contrib/admin/templates/admin/change_form.html

     
    22{% load i18n admin_modify adminmedia %}
    33
    44{% block extrahead %}{{ block.super }}
     5<script type="text/javascript">var admin_media_prefix = "{{ admin_media_prefix }}"</script>
    56<script type="text/javascript" src="../../../jsi18n/"></script>
    67{{ media }}
    78{% endblock %}
Back to Top