Ticket #6183: django-6183.patch
File django-6183.patch, 2.8 KB (added by , 15 years ago) |
---|
-
django/contrib/admin/media/js/SelectFilter2.js
old new 14 14 return node; 15 15 } 16 16 17 function findSelectMultipleHelpTextNode(node) { 18 var nodes = node.getElementsByTagName('span'); 19 for (var i=0, length=nodes.length; i<length; i++) { 20 if (nodes[i].className == 'select-multiple-help-text') { 21 // assume there's only one 22 return nodes[i]; 23 } 24 } 25 return null; 26 } 27 28 function findHelpTextNodes(node) { 29 var nodes = node.getElementsByTagName('p'); 30 var result = []; 31 for (var i=0, length=nodes.length; i<length; i++) { 32 if (nodes[i].className == 'help') { 33 result.push(nodes[i]); 34 } 35 } 36 return result; 37 } 38 17 39 var SelectFilter = { 18 40 init: function(field_id, field_name, is_stacked, admin_media_prefix) { 19 41 var from_box = document.getElementById(field_id); 20 42 from_box.id += '_from'; // change its ID 21 43 from_box.className = 'filtered'; 22 44 23 // Remove <p class="info">, because it just gets in the way. 24 var ps = from_box.parentNode.getElementsByTagName('p'); 25 for (var i=0; i<ps.length; i++) { 26 from_box.parentNode.removeChild(ps[i]); 45 // Find and remove the span tag wich holds the 46 // 'Hold down "Control", or "Command" on a Mac, to select more than one.' 47 // message. 48 var smhelp_node = findSelectMultipleHelpTextNode(from_box.parentNode); 49 if (smhelp_node) { 50 smhelp_node.parentNode.removeChild(smhelp_node); 27 51 } 28 52 53 // Find and remove all user supplied help_text's. 54 var help_text_nodes = findHelpTextNodes(from_box.parentNode); 55 for (var i = help_text_nodes.length - 1; i >= 0; i--) { 56 var node = help_text_nodes[i]; 57 var parent = node.parentNode; 58 59 if (node !== parent.firstChild) { 60 parent.insertBefore(help_text_nodes[i], parent.firstChild); 61 } 62 } 63 29 64 // <div class="selector"> or <div class="selector stacked"> 30 65 var selector_div = quickElement('div', from_box.parentNode); 31 66 selector_div.className = is_stacked ? 'selector stacked' : 'selector'; -
django/db/models/fields/related.py
old new 813 813 814 814 Field.__init__(self, **kwargs) 815 815 816 msg = ugettext_lazy(' Hold down "Control", or "Command" on a Mac, to select more than one.')816 msg = ugettext_lazy('<span class="select-multiple-help-text">Hold down "Control", or "Command" on a Mac, to select more than one.</span>') 817 817 self.help_text = string_concat(self.help_text, ' ', msg) 818 818 819 819 def get_choices_default(self):