本文整理匯總了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={})