derek-schaefer / django-json-field

Generic JSON model and form fields.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong default value for South migration

fangsterr opened this issue · comments

I create a new field on my model as such:

some_json_field = JSONField(default=[], blank=True)

However, when I generate the schemamigration (using python manage.py schemamigration appname --auto) and migrate, the field on existing model instances for the some_json_field are the string "[]" instead of []

Thanks for reporting this. I'll look into it.

We've seen a similar problem with a field default of "{}", which is intended to be an empty JSON object but gets encoded as the literal unicode string "{}". I couldn't figure out exactly where this goes wrong, so I applied a band-aid in our product: deis/deis#1616

If anyone knows where this might be happening, I would love to debug it and push a fix back upstream to django-json-field. It's worked great for us other than this.