Code

Ticket #9321: hold-control-selectmultiple-fix.2.patch

File hold-control-selectmultiple-fix.2.patch, 1.5 KB (added by marcdm, 2 years ago)

patch described in comment 33

Line 
1diff '--exclude=*.pyc' -r django-1.4/db/models/fields/related.py django-custom/db/models/fields/related.py
21120,1122d1119
3<         msg = _('Hold down "Control", or "Command" on a Mac, to select more than one.')
4<         self.help_text = string_concat(self.help_text, ' ', msg)
5<
6diff '--exclude=*.pyc' -r django-1.4/forms/fields.py django-custom/forms/fields.py
728c28
8< from django.utils.translation import ugettext_lazy as _
9---
10> from django.utils.translation import ugettext_lazy as _, string_concat
11696a697,710
12>         
13>     def _patch_help_text(self):
14>         '''function that appends the help text. implemented only for
15>         sub-classes that use the SelectMultiple widget should call this
16>         on their constructor'''
17>         if hasattr(self, '_multiselect_patched') :
18>             pass
19>         else :
20>             if type(self.widget)  is SelectMultiple :
21>                 msg = _('Hold down "Control", or "Command" on a Mac, to select more than one.')
22>                 self.help_text = string_concat(self.help_text, ' ', msg)
23>                 setattr(self,'_multiselect_patched',True)
24>             else :
25>                 setattr(self,'_multiselect_patched',False)
26771a786,788
27>     def __init__(self,*arg,**kwarg):
28>         super(MultipleChoiceField,self).__init__(*arg,**kwarg)
29>         self._patch_help_text()
30diff '--exclude=*.pyc' -r django-1.4/forms/models.py django-custom/forms/models.py
31930a931,933
32>
33>         self._patch_help_text()       
34>