mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-05-08 01:43:43 +03:00
Remove Django 1.5 clean_manytomany_helptext fallback
This commit is contained in:
parent
25de8c960f
commit
8ea1606abf
|
@ -106,17 +106,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
django_filters = None
|
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
|
# Django-guardian is optional. Import only if guardian is in INSTALLED_APPS
|
||||||
# Fixes (#1712). We keep the try/except for the test suite.
|
# Fixes (#1712). We keep the try/except for the test suite.
|
||||||
guardian = None
|
guardian = None
|
||||||
|
|
|
@ -8,7 +8,6 @@ from django.core import validators
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
|
|
||||||
from rest_framework.compat import clean_manytomany_helptext
|
|
||||||
from rest_framework.validators import UniqueValidator
|
from rest_framework.validators import UniqueValidator
|
||||||
|
|
||||||
NUMERIC_FIELD_TYPES = (
|
NUMERIC_FIELD_TYPES = (
|
||||||
|
@ -222,7 +221,7 @@ def get_relation_kwargs(field_name, relation_info):
|
||||||
if model_field:
|
if model_field:
|
||||||
if model_field.verbose_name and needs_label(model_field, field_name):
|
if model_field.verbose_name and needs_label(model_field, field_name):
|
||||||
kwargs['label'] = capfirst(model_field.verbose_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:
|
if help_text:
|
||||||
kwargs['help_text'] = help_text
|
kwargs['help_text'] = help_text
|
||||||
if not model_field.editable:
|
if not model_field.editable:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user