【发布时间】:2020-02-16 02:17:51
【问题描述】:
我将 Django 3.0a 与 Python 3.7 一起使用
我已经搜索了很多与数据库 sqlite 和其他(我知道 Django > 2.2 支持 JSONfield for postgres)一起使用的 JSON 字段
现在我已经尝试过这个库:
- https://github.com/adamchainz/django-jsonfield
- https://github.com/dmkoch/django-jsonfield
- https://github.com/rpkilby/jsonfield2/
它们都抛出非常相似的错误:
from django.utils import six
ImportError: cannot import name 'six' from 'django.utils' (C:\Program Files (x86)\Python37-32\lib\site-packages\django-3.0a1-py3.7.e
gg\django\utils\__init__.py)
我搜索了这个问题,发现缺少的“六”库假设处理 Python 2 和 3 之间的差异。
我该如何解决它,或者您知道在 Django 模型中使用 JSON 字段的另一种方法吗?
非常感谢
【问题讨论】:
-
您使用 alpha 版本有什么特殊原因吗?
-
不,实际上这是我的第一个项目,我刚刚用 pip 下载了最新的
-
试用最新发布的 Django 2.2 版本。
-
试过了,现在我正在使用 Django 2.2.6,它工作正常!另一个问题是我不能在我的模板中使用它...
-
这是我尝试在模板中实现的方式:
{{ result.search_inputs|txtmegusha }} “txtmegusha”是字典的键
标签: python json python-3.x django-jsonfield django-3.0