Thursday, May 25, 2017

Django 1.11: JSONField loaded as string during migration's RunPython

Hello,

We are moving to Django 1.11, but we have some models with JSONField fields, which are being used on some custom migration functions (called with RunPython). We're getting the following kind of errors:

    _ForecastType = apps.get_model('forecast', 'forecasttype')
    for forecast_type in _ForecastType.objects.all():
>     hours = forecast_type.params['reception_hours']
E     TypeError: string indices must be integers

so Django is not properly loading the field during the migration. What should we do to fix it?

Thanks very much for any help,
Hector.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4d634ed6-e75d-4a7e-aa4c-3c5514e34ac0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment