Django 1.9-模型中的JSONField [英] Django 1.9 - JSONField in Models

查看:103
本文介绍了Django 1.9-模型中的JSONField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用新的JSONField在Django 1.9中设置模型文件。我发现了使用postgres的示例,但没有使用MySql的示例。在使用postgres的示例中,他们从django.contrib.postgres.fields import JSONField

  $ c> 

如何为MySql导入呢?
谢谢

解决方案

Django JSONField 仅是Postgres。 / p>

https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#django.contrib.postgres.fields.JSONField



更新:



通过第三方库支持 MYSQL django-mysql


I'm trying to set up a models file in Django 1.9 using the new JSONField. I have found examples using postgres but none with MySql. In the examples with postgres they do a

from django.contrib.postgres.fields import JSONField

How do I go about importing it for MySql? Thanks

解决方案

Django JSONField is Postgres only.

https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#django.contrib.postgres.fields.JSONField

UPDATE:

There is support for MYSQL via 3rd party library django-mysql

这篇关于Django 1.9-模型中的JSONField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆