Make sure template API renders in non US languages.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-09-26 16:41:54 -04:00
parent e46f55a2a2
commit d3c1204626
3 changed files with 21 additions and 4 deletions

View File

@@ -1,7 +1,14 @@
3.1.3 (2018-09-26)
==================
* Make sure template API renders in non US languages.
3.1.2 (2018-09-21) 3.1.2 (2018-09-21)
================== ==================
* Database access in data migrations defaults to the 'default' database. Force it to the user selected database instead. * Database access in data migrations defaults to the 'default' database.
* Don't use a hardcoded database alias for the destination of the database conversion. Force it to the user selected database instead.
* Don't use a hardcoded database alias for the destination of the database
conversion.
* Improve natural key support in the UserOptions model. * Improve natural key support in the UserOptions model.
* Update from Django 1.11.11 to 1.11.15. * Update from Django 1.11.11 to 1.11.15.
* Add support to the convertdb command to operate on specified apps too. * Add support to the convertdb command to operate on specified apps too.
@@ -11,7 +18,8 @@
* Add support for natural keys to the DocumentPageImageCache model. * Add support for natural keys to the DocumentPageImageCache model.
* Add database conversion test to the common app. * Add database conversion test to the common app.
* Fix label display for resolved smart links when not using a dynamic label. * Fix label display for resolved smart links when not using a dynamic label.
* Only show smart link resolution errors to the user with the smart link edit permission. * Only show smart link resolution errors to the user with the smart link edit
permission.
* Intercept document list view exception and display them as an error message. * Intercept document list view exception and display them as an error message.
3.1.1 (2018-09-18) 3.1.1 (2018-09-18)

View File

@@ -393,7 +393,7 @@ class Template(object):
context=context, context=context,
).render() ).render()
self.html = result.content self.html = result.rendered_content
self.hex_hash = hashlib.sha256(result.content).hexdigest() self.hex_hash = hashlib.sha256(result.content).hexdigest()
return self return self

View File

@@ -1,11 +1,20 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.urls import reverse from django.urls import reverse
from django.test import override_settings
from rest_api.tests import BaseAPITestCase from rest_api.tests import BaseAPITestCase
from ..classes import Template
class CommonAPITestCase(BaseAPITestCase): class CommonAPITestCase(BaseAPITestCase):
def test_content_type_list_view(self): def test_content_type_list_view(self):
response = self.client.get(reverse('rest_api:content-type-list')) response = self.client.get(reverse('rest_api:content-type-list'))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
@override_settings(LANGUAGE_CODE='de')
def test_template_detail_view(self):
template_main_menu = Template.get(name='main_menu')
response = self.client.get(template_main_menu.get_absolute_url())
self.assertEqual(response.status_code, 200)