Django 升级到4.0注意事项

日常笔记
回复
adm1n
Site Admin
帖子: 143
注册时间: 周六 6月 28, 2014 10:03 pm

Django 升级到4.0注意事项

帖子 adm1n »

in django 4.0 we dont have force_text

https://docs.djangoproject.com/en/4.0/r ... s.encoding

instead change force_text to force_str

linux:

YOUR_VENV/lib/PYTHON_VERSION/site-packages/graphene_django/utils/utils.py

windows:

YOUR_VENV/lib/site-packages/graphene_django/utils/utils.py

from django.utils.encoding import force_text
to

from django.utils.encoding import force_str
and

代码: 全选

def _camelize_django_str(s):
    if isinstance(s, Promise):
        s = force_text(s)
    return to_camel_case(s) if isinstance(s, six.string_types) else s
to

代码: 全选

def _camelize_django_str(s):
    if isinstance(s, Promise):
        s = force_str(s)
    return to_camel_case(s) if isinstance(s, six.string_types) else s
回复