From 761d68cf9c3e505c223c288ef6c79c33b1bf867a Mon Sep 17 00:00:00 2001 From: ron Date: Sun, 27 Aug 2023 14:27:07 +0300 Subject: [PATCH] django 1 compatability changes --- jsonfield/encoder.py | 4 ++-- jsonfield/fields.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jsonfield/encoder.py b/jsonfield/encoder.py index 01a4c54..2af1687 100644 --- a/jsonfield/encoder.py +++ b/jsonfield/encoder.py @@ -7,7 +7,7 @@ from django.db.models.query import QuerySet from django.utils import timezone -from django.utils.encoding import force_text +from django.utils.encoding import force_str from django.utils.functional import Promise @@ -22,7 +22,7 @@ def default(self, obj): # noqa # For Date Time string spec, see ECMA 262 # http://ecma-international.org/ecma-262/5.1/#sec-15.9.1.15 if isinstance(obj, Promise): - return force_text(obj) + return force_str(obj) elif isinstance(obj, datetime.datetime): representation = obj.isoformat() if obj.microsecond: diff --git a/jsonfield/fields.py b/jsonfield/fields.py index 13bf1d9..7b5e0f3 100644 --- a/jsonfield/fields.py +++ b/jsonfield/fields.py @@ -5,7 +5,7 @@ from django.db import models from django.forms import fields -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .encoder import JSONEncoder from .subclassing import SubfieldBase