本文整理汇总了Python中jsonfield.fields方法的典型用法代码示例。如果您正苦于以下问题:Python jsonfield.fields方法的具体用法?Python jsonfield.fields怎么用?Python jsonfield.fields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsonfield
的用法示例。
在下文中一共展示了jsonfield.fields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_default_value
# 需要导入模块: import jsonfield [as 别名]
# 或者: from jsonfield import fields [as 别名]
def add_default_value(apps, schema_editor):
# MySQL does not support default values on TEXT fields,
# which back JSONField fields, and so the migration will
# fill in the column with the empty string, which is not
# valid JSON. This is a problem any time we add a JSONField
# in a migration *if* there are any rows in the table already.
# Since we create AppSource instances in migration 0016_auto_20170313_1639,
# there are definitely rows already.
AppSource = apps.get_model("guidedmodules", "AppSource")
AppSource.objects.update(approved_apps={})