summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorqingfeng <qingfenghello@gmail.com>2014-07-22 01:38:34 +0800
committerClaude Paroz <claude@2xlibre.net>2014-07-26 18:04:01 +0200
commit3a2badcbb73c2aed6451d2451da1c4fc8d934ab2 (patch)
tree9b8e5844c97ac7318b429edd4c05c4b6be219b9a /tests
parent1ef544f91f0d4be3f44ae7fd0498530e57a9b160 (diff)
[1.7.x] Fixed #23060 -- Prevented UnicodeDecodeError in debug templatetag
Backport of 08451f17d0 from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/template_tests/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index 9ddd6f36c7..46c4148849 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -10,6 +10,7 @@ import warnings
from django import template
from django.conf import settings
+from django.contrib.auth.models import Group
from django.core import urlresolvers
from django.template import (base as template_base, loader, Context,
RequestContext, Template, TemplateSyntaxError)
@@ -524,6 +525,15 @@ class TemplateRegressionTests(TestCase):
with self.assertRaises(urlresolvers.NoReverseMatch):
t.render(Context({}))
+ def test_debug_tag_non_ascii(self):
+ """
+ Test non-ASCII model representation in debug output (#23060).
+ """
+ Group.objects.create(name="清風")
+ c1 = Context({"objs": Group.objects.all()})
+ t1 = Template('{% debug %}')
+ self.assertIn("清風", t1.render(c1))
+
# Set ALLOWED_INCLUDE_ROOTS so that ssi works.
@override_settings(MEDIA_URL="/media/", STATIC_URL="/static/",