From dce9dcbb4bf569386d630de0caeba41c5750c9ae Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 15 May 2020 11:32:39 +0200 Subject: [PATCH] dj22: decode response.content (#42950) It seems that starting with Django 2.0 bytes are not automatically decoded when used in templates, as py3 with Django 1.11 does not show byte strings in login templates. --- src/authentic2/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/authentic2/utils/__init__.py src/authentic2/utils/__init__.py index 419c8c90..25179b0e 100644 --- src/authentic2/utils/__init__.py +++ src/authentic2/utils/__init__.py @@ -217,7 +217,7 @@ def get_authenticator_method(authenticator, method, parameters): # Force a TemplateResponse to be rendered. if not getattr(response, 'is_rendered', True) and callable(getattr(response, 'render', None)): response = response.render() - content = response.content + content = response.content.decode('utf-8') status_code = response.status_code if hasattr(response, 'context_data') and response.context_data: extra_css_class = response.context_data.get('block-extra-css-class', '') -- 2.26.0