diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index 1376f6d46..dca113bf5 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -1,6 +1,5 @@ from __future__ import absolute_import, unicode_literals -import decimal import re from django import template @@ -133,6 +132,8 @@ def format_value(value): return mark_safe('{value}'.format(value=escape(value))) elif '@' in value and not re.search(r'\s', value): return mark_safe('{value}'.format(value=escape(value))) + elif '\n' in value: + return mark_safe('
%s' % escape(value)) return six.text_type(value)