Skip to content

Commit 2408c1c

Browse files
committed
Fix issue #169 (compatibility for django<=3.x)
1 parent 2670a21 commit 2408c1c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

martor/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
from __future__ import unicode_literals
33

44
from django.utils.functional import Promise
5-
from django.utils.encoding import force_str
65
from django.core.serializers.json import DjangoJSONEncoder
76

7+
try:
8+
from django.utils.encoding import force_str # noqa: Django>=4.x
9+
except ImportError:
10+
from django.utils.encoding import force_text as force_str # noqa: Django<=3.x
11+
812
import markdown
913
from .settings import (
1014
MARTOR_MARKDOWN_EXTENSIONS,

0 commit comments

Comments
 (0)