Skip to content

Commit 2c35e21

Browse files
committed
Preventing unicode errors due to unicode->str coercion.
1 parent a014695 commit 2c35e21

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

django_react/render.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django.contrib.staticfiles import finders
44
from django.core.serializers.json import DjangoJSONEncoder
55
from django.utils.safestring import mark_safe
6+
from optional_django import six
67
from .exceptions import ComponentSourceFileNotFound, ComponentWasNotBundled
78
from .services import RenderService
89
from .settings import WATCH_SOURCE
@@ -31,7 +32,10 @@ def __unicode__(self):
3132
def render_markup(self):
3233
markup = self.markup
3334
if self.bundle and not self.to_static_markup:
34-
markup = '<span id="{id}">{markup}</span>'.format(
35+
template = '<span id="{id}">{markup}</span>'
36+
if six.PY2:
37+
template = unicode(template)
38+
markup = template.format(
3539
id=self.get_container_id(),
3640
markup=markup,
3741
)

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
django
22
django-node==4.0.0
3-
django-webpack==3.0.1
3+
django-webpack==3.0.1
4+
optional-django==0.1.0

0 commit comments

Comments
 (0)