diff --git a/constance/templates/admin/constance/change_list.html b/constance/templates/admin/constance/change_list.html index 7751b94..d284ffd 100644 --- a/constance/templates/admin/constance/change_list.html +++ b/constance/templates/admin/constance/change_list.html @@ -63,7 +63,7 @@ {% for item in config %} {{ item.name }} -
{{ item.help_text }}
+
{{ item.help_text|linebreaksbr }}
{{ item.default }} diff --git a/tests/settings.py b/tests/settings.py index 04a428a..bce6f88 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -63,6 +63,7 @@ CONSTANCE_CONFIG = { 'FLOAT_VALUE': (3.1415926536, 'PI'), 'DATE_VALUE': (date(2010, 12, 24), 'Merry Chrismas'), 'TIME_VALUE': (time(23, 59, 59), 'And happy New Year'), + 'LINEBREAK_VALUE': ('Spam spam', 'eggs\neggs'), } DEBUG = True @@ -70,3 +71,19 @@ DEBUG = True STATIC_ROOT = './static/' STATIC_URL = '/static/' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] diff --git a/tests/test_admin.py b/tests/test_admin.py index 19493a1..5ad5806 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py @@ -50,3 +50,11 @@ class TestAdmin(TestCase): def test_str(self): ct = ContentType.objects.get(app_label='constance', model='config') self.assertEqual(six.text_type(ct), 'config') + + def test_linebreaks(self): + self.client.login(username='admin', password='nimda') + request = self.rf.get('/admin/constance/config/') + request.user = self.superuser + response = self.options.changelist_view(request, {}) + self.assertContains(response, 'LINEBREAK_VALUE') + self.assertContains(response, 'eggs
eggs') diff --git a/tox.ini b/tox.ini index f021048..8884bd0 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,8 @@ deps = django-master: https://github.com/django/django/archive/master.tar.gz usedevelop = true commands = - coverage run {envbindir}/django-admin.py test --settings=tests.settings -v2 + coverage run {envbindir}/django-admin.py test -v2 coverage report setenv = PYTHONDONTWRITEBYTECODE=1 + DJANGO_SETTINGS_MODULE=tests.settings