This commit is contained in:
Iliyan Angelov
2025-10-07 22:10:27 +03:00
parent 3f5bcfad68
commit d48c54e2c5
3221 changed files with 40187 additions and 92575 deletions

View File

@@ -17,15 +17,6 @@ from rest_framework.views import APIView
from .app_settings import swagger_settings
try:
import zoneinfo
except ImportError:
try:
from backports import zoneinfo
except ImportError:
zoneinfo = None
logger = logging.getLogger(__name__)
@@ -451,7 +442,7 @@ def force_real_str(s, encoding='utf-8', strings_only=False, errors='strict'):
"""
if s is not None:
s = force_str(s, encoding, strings_only, errors)
if type(s) is not str:
if type(s) != str:
s = '' + s
# Remove common indentation to get the correct Markdown rendering
@@ -474,10 +465,7 @@ def field_value_to_representation(field, value):
else:
value = str(value)
elif isinstance(value, pytz.BaseTzInfo):
value = str(value)
elif zoneinfo is not None and isinstance(value, zoneinfo.ZoneInfo):
if isinstance(value, pytz.BaseTzInfo):
value = str(value)
# JSON roundtrip ensures that the value is valid JSON;