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

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

_patch_help_text() function and calls for ChoiceField and subsclasses

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,711
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> print '%s - %s'%(smart_str(self.label), repr(type(self.widget)))
21> if type(self.widget) is SelectMultiple :
22> msg = _('Hold down "Control", or "Command" on a Mac, to select more than one.')
23> self.help_text = string_concat(self.help_text, ' ', msg)
24> setattr(self,'_multiselect_patched',True)
25> else :
26> setattr(self,'_multiselect_patched',False)
27771a787,789
28> def __init__(self,*arg,**kwarg):
29> super(MultipleChoiceField,self).__init__(*arg,**kwarg)
30> self._patch_help_text()
31diff '--exclude=*.pyc' -r django-1.4/forms/models.py django-custom/forms/models.py
32930a931,933
33>
34> self._patch_help_text()
35>
Back to Top