We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e34e33d + 2408c1c commit 8c76232Copy full SHA for 8c76232
martor/utils.py
@@ -2,9 +2,13 @@
2
from __future__ import unicode_literals
3
4
from django.utils.functional import Promise
5
-from django.utils.encoding import force_text
6
from django.core.serializers.json import DjangoJSONEncoder
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
+
12
import markdown
13
from .settings import (
14
MARTOR_MARKDOWN_EXTENSIONS,
@@ -56,5 +60,5 @@ class LazyEncoder(DjangoJSONEncoder):
56
60
57
61
def default(self, obj):
58
62
if isinstance(obj, Promise):
59
- return force_text(obj)
63
+ return force_str(obj)
64
return super(LazyEncoder, self).default(obj)
0 commit comments