django-json-field icon indicating copy to clipboard operation
django-json-field copied to clipboard

Wrong default value for South migration

Open fangsterr opened this issue 12 years ago • 2 comments
trafficstars

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 []

fangsterr avatar Nov 03 '13 07:11 fangsterr

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

derek-schaefer avatar Nov 16 '13 01:11 derek-schaefer

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: https://github.com/deis/deis/pull/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.

mboersma avatar Aug 18 '14 23:08 mboersma