summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2013-05-21 18:32:39 -0300
committerRamiro Morales <cramm0@gmail.com>2013-05-23 07:49:29 -0300
commit8c2fd050f80f528cc1609c1a7f16901194834831 (patch)
treeeb8a44065ec57c9fefb6ef6914247c8a27637769 /django/forms
parent01769823f13df6e922faf63a2ac07293dc54b176 (diff)
Made fix for #9321 less buggy and more effective.
Don't try to be smart about building a good-looking help string because it evaluates translations too early, simply use the same old strategy as before. Thanks Donald Stufft for the report. Also, actually fix the case reported by the OP by special-casing CheckboxSelectMultiple. Added tests. Refs #9321.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/models.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 68c1341cf7..9d5aa5d4d8 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -13,7 +13,7 @@ from django.forms.forms import BaseForm, get_declared_fields
from django.forms.formsets import BaseFormSet, formset_factory
from django.forms.util import ErrorList
from django.forms.widgets import (SelectMultiple, HiddenInput,
- MultipleHiddenInput, media_property)
+ MultipleHiddenInput, media_property, CheckboxSelectMultiple)
from django.utils.encoding import smart_text, force_text
from django.utils.datastructures import SortedDict
from django.utils import six
@@ -1104,9 +1104,10 @@ class ModelMultipleChoiceField(ModelChoiceField):
super(ModelMultipleChoiceField, self).__init__(queryset, None,
cache_choices, required, widget, label, initial, help_text,
*args, **kwargs)
- if isinstance(self.widget, SelectMultiple):
+ # Remove this in Django 1.8
+ if isinstance(self.widget, SelectMultiple) and not isinstance(self.widget, CheckboxSelectMultiple):
msg = _('Hold down "Control", or "Command" on a Mac, to select more than one.')
- self.help_text = string_concat(self.help_text, ' ', msg) if self.help_text else msg
+ self.help_text = string_concat(self.help_text, ' ', msg)
def clean(self, value):
if self.required and not value: