aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorTom Christie2013-07-05 08:55:24 +0100
committerTom Christie2013-07-05 08:55:24 +0100
commit676ab4971ceef4186747df8a0a45e4ff0c7eb80c (patch)
treee56c7a0c8d8356203860332b852a47b62c264f0d /rest_framework/fields.py
parent99794773cf6b865b5b860b35db31dea92968c605 (diff)
parent7d43f41e4aa50c4258ec1d7b63dd62a01440fa9d (diff)
downloaddjango-rest-framework-676ab4971ceef4186747df8a0a45e4ff0c7eb80c.tar.bz2
Merge branch 'remove-hold-down-control-messages' of git://github.com/rouge8/django-rest-framework into rouge8-remove-hold-down-control-messages
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index 35848b4c..1a0ad3b9 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -100,6 +100,19 @@ def humanize_strptime(format_string):
return format_string
+def strip_multiple_choice_msg(help_text):
+ """
+ Remove the 'Hold down "control" ...' message that is enforced in select
+ multiple fields.
+
+ See https://code.djangoproject.com/ticket/9321
+ """
+ multiple_choice_msg = _(' Hold down "Control", or "Command" on a Mac, to select more than one.')
+ multiple_choice_msg = unicode(multiple_choice_msg)
+
+ return help_text.replace(multiple_choice_msg, '')
+
+
class Field(object):
read_only = True
creation_counter = 0
@@ -122,7 +135,7 @@ class Field(object):
self.label = smart_text(label)
if help_text is not None:
- self.help_text = smart_text(help_text)
+ self.help_text = strip_multiple_choice_msg(smart_text(help_text))
def initialize(self, parent, field_name):
"""