From 8ea1606abf5eee6a3e97c71b3cc93a81e362d782 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 21 Sep 2015 20:16:52 +0200 Subject: [PATCH] Remove Django 1.5 clean_manytomany_helptext fallback --- rest_framework/compat.py | 11 ----------- rest_framework/utils/field_mapping.py | 3 +-- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index b348f05a9..fcca2dcbf 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -106,17 +106,6 @@ try: except ImportError: django_filters = None -if django.VERSION >= (1, 6): - def clean_manytomany_helptext(text): - return text -else: - # Up to version 1.5 many to many fields automatically suffix - # the `help_text` attribute with hardcoded text. - def clean_manytomany_helptext(text): - if text.endswith(' Hold down "Control", or "Command" on a Mac, to select more than one.'): - text = text[:-69] - return text - # Django-guardian is optional. Import only if guardian is in INSTALLED_APPS # Fixes (#1712). We keep the try/except for the test suite. guardian = None diff --git a/rest_framework/utils/field_mapping.py b/rest_framework/utils/field_mapping.py index f2598974e..a28553693 100644 --- a/rest_framework/utils/field_mapping.py +++ b/rest_framework/utils/field_mapping.py @@ -8,7 +8,6 @@ from django.core import validators from django.db import models from django.utils.text import capfirst -from rest_framework.compat import clean_manytomany_helptext from rest_framework.validators import UniqueValidator NUMERIC_FIELD_TYPES = ( @@ -222,7 +221,7 @@ def get_relation_kwargs(field_name, relation_info): if model_field: if model_field.verbose_name and needs_label(model_field, field_name): kwargs['label'] = capfirst(model_field.verbose_name) - help_text = clean_manytomany_helptext(model_field.help_text) + help_text = model_field.help_text if help_text: kwargs['help_text'] = help_text if not model_field.editable: