Code

Ticket #7985: 7985-modified.patch

File 7985-modified.patch, 1.2 KB (added by ramikassab, 6 years ago)

Modified patch since the JS the first patch refers to has been moved...

  • django/contrib/admin/templates/admin/prepopulated_fields_js.html

     
    11<script type="text/javascript"> 
    22{% for field in prepopulated_fields %} 
    3     document.getElementById("{{ field.field.auto_id }}").onchange = function() { this._changed = true; }; 
     3    addEvent(document.getElementById("{{ field.field.auto_id }}"), 'change', function() { this._changed = true; });  
    44    {% for dependency in field.dependencies %} 
    5     document.getElementById("{{ dependency.auto_id }}").onkeyup = function() { 
     5        addEvent(document.getElementById("{{ dependency.auto_id }}"), 'keyup', function() {  
    66        var e = document.getElementById("{{ field.field.auto_id }}"); 
    77        if (!e._changed) { e.value = URLify({% for innerdep in field.dependencies %}document.getElementById("{{ innerdep.auto_id }}").value{% if not forloop.last %} + ' ' + {% endif %}{% endfor %}, {{ field.field.field.max_length }}); } 
    8     } 
     8    }); 
    99    {% endfor %} 
    1010{% endfor %} 
    11 </script> 
    12  No newline at end of file 
     11</script>