aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Christie2013-07-05 09:07:18 +0100
committerTom Christie2013-07-05 09:07:18 +0100
commit8f79caf9d1bd4a3de8371c61f24dcf513454f06b (patch)
tree7a27d21f97e486da772ed233901dac6b48be3f27
parent676ab4971ceef4186747df8a0a45e4ff0c7eb80c (diff)
downloaddjango-rest-framework-8f79caf9d1bd4a3de8371c61f24dcf513454f06b.tar.bz2
Use 'force_text', not 'unicode', for compat across python version
-rw-r--r--rest_framework/fields.py6
-rw-r--r--rest_framework/tests/test_serializer.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index 1a0ad3b9..6e5ee470 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -102,13 +102,13 @@ def humanize_strptime(format_string):
def strip_multiple_choice_msg(help_text):
"""
- Remove the 'Hold down "control" ...' message that is enforced in select
- multiple fields.
+ Remove the 'Hold down "control" ...' message that is Django enforces in
+ select multiple fields on ModelForms. (Required for 1.5 and earlier)
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)
+ multiple_choice_msg = force_text(multiple_choice_msg)
return help_text.replace(multiple_choice_msg, '')
diff --git a/rest_framework/tests/test_serializer.py b/rest_framework/tests/test_serializer.py
index 6c18f15c..38acc354 100644
--- a/rest_framework/tests/test_serializer.py
+++ b/rest_framework/tests/test_serializer.py
@@ -1385,7 +1385,7 @@ class ManyFieldHelpTextTest(TestCase):
message that Django appends to choice fields.
"""
rel_field = fields.Field(help_text=ManyToManyModel._meta.get_field('rel').help_text)
- self.assertEqual('Some help text.', unicode(rel_field.help_text))
+ self.assertEqual('Some help text.', rel_field.help_text)
class AttributeMappingOnAutogeneratedFieldsTests(TestCase):