django-extensions/django-extensions — pull request #201 by dhepper (2012-04-22 14:59:50+00:00)
Title: Change JSONField to allow empty lists

Currently, JSONField.to_python(value) returns a dict if value is falsy. This makes it impossible to store empty lists:

>>> j = TestModel.objects.create(a=6, j_field=[])
>>> j.j_field
{}

I've changed it to return a dict only on None and empty strings, allowing empty lists:

>>> j = TestModel.objects.create(a=6, j_field=[])
>>> j.j_field
[]