Python jsonfield.fields() Examples

The following are 1 code examples of jsonfield.fields(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module jsonfield , or try the search function .
Example #1
Source File: 0039_appsource_approved_apps.py    From govready-q with GNU General Public License v3.0 5 votes vote down vote up
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={})