Skip to content

Commit 0f5abd7

Browse files
committed
Do not apply fix for multichoice help text in later version of Django.
The initial fix could cause problems in Django 1.7 when serializers get used as a field. This is due to `force_text` being applied before full initialization of the apps registry (see encode#1907). The fix doesn't seem to be required after version 1.6: https://code.djangoproject.com/ticket/9321
1 parent ad14978 commit 0f5abd7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rest_framework/fields.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import re
1212
import warnings
1313
from decimal import Decimal, DecimalException
14+
import django
1415
from django import forms
1516
from django.core import validators
1617
from django.core.exceptions import ValidationError
@@ -143,7 +144,10 @@ def __init__(self, source=None, label=None, help_text=None):
143144
self.label = None
144145

145146
if help_text is not None:
146-
self.help_text = strip_multiple_choice_msg(smart_text(help_text))
147+
help_text = smart_text(help_text)
148+
if django.VERSION <= (1, 5):
149+
help_text = strip_multiple_choice_msg(help_text)
150+
self.help_text = help_text
147151
else:
148152
self.help_text = None
149153

0 commit comments

Comments
 (0)