diff options
| author | Andy Freeland | 2013-07-04 01:51:24 -0400 |
|---|---|---|
| committer | Andy Freeland | 2013-07-04 01:51:24 -0400 |
| commit | 7d43f41e4aa50c4258ec1d7b63dd62a01440fa9d (patch) | |
| tree | 32000eb5d76544a1a6323b5d0d62b514724d772a /rest_framework/tests | |
| parent | 7c0019854bd0ed18f4b189f14232f7406977d897 (diff) | |
| download | django-rest-framework-7d43f41e4aa50c4258ec1d7b63dd62a01440fa9d.tar.bz2 | |
Remove 'Hold down "Control" ...' message from help_text
When getting the help_text from a field where `many=True`, Django
appends 'Hold down "Control", or "Command" on a Mac, to select more than
one.' to the help_text. This makes some sense in Django's ModelForms,
but no sense in the API.
Diffstat (limited to 'rest_framework/tests')
| -rw-r--r-- | rest_framework/tests/models.py | 2 | ||||
| -rw-r--r-- | rest_framework/tests/test_serializer.py | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/rest_framework/tests/models.py b/rest_framework/tests/models.py index e2d4eacd..1598ecd9 100644 --- a/rest_framework/tests/models.py +++ b/rest_framework/tests/models.py @@ -52,7 +52,7 @@ class CallableDefaultValueModel(RESTFrameworkModel): class ManyToManyModel(RESTFrameworkModel): - rel = models.ManyToManyField(Anchor) + rel = models.ManyToManyField(Anchor, help_text='Some help text.') class ReadOnlyManyToManyModel(RESTFrameworkModel): diff --git a/rest_framework/tests/test_serializer.py b/rest_framework/tests/test_serializer.py index 8b87a084..6c18f15c 100644 --- a/rest_framework/tests/test_serializer.py +++ b/rest_framework/tests/test_serializer.py @@ -1376,6 +1376,18 @@ class FieldLabelTest(TestCase): self.assertEqual('Label', relations.HyperlinkedRelatedField(view_name='fake', label='Label', help_text='Help', many=True).label) +# Test for issue #961 + +class ManyFieldHelpTextTest(TestCase): + def test_help_text_no_hold_down_control_msg(self): + """ + Validate that help_text doesn't contain the 'Hold down "Control" ...' + 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)) + + class AttributeMappingOnAutogeneratedFieldsTests(TestCase): def setUp(self): |
