Custom encoding for JSONField will be a feature in Django 1.11. See if https://github.com/django/django/pull/7071/commits/13c3e5d5a05e9c358d212d154addd703cac3bc66 and the documentation tips in that patch helps.
On Sunday, August 28, 2016 at 2:15:38 PM UTC-4, Ben Scherrey wrote: > > I have an application where we've upgraded from Django 1.7 to 1.9 that > makes extensive use of the new Postgres JSONField type. Now that JSONField > is native to Django I'm trying to get it to work with our existing code > base. We have a class that won't automatically serialize to json so I've > extended the JSONField class with a new JSONSerializedField which basically > attempts to call to_json() and from_json() methods on objects if it can. > > Here's the code: https://bpaste.net/show/52e05f5ae2a9 > > By overloading get_prep_value() I've been able to handle the python->json > conversion. I'm having trouble figuring out what I need to overload to > handle the json->python conversion, however. Overloading to_python() > doesn't seem to work as my method is never called. How can I achieve what > my to_python method is trying to accomplish with the new JSONField? > > thanx, > > -- Ben Scherrey > > -- > Chief Systems Architect Proteus Technologies <http://proteus-tech.com> > > This email intended solely for those who have received it. If you have > received this email by accident - well lucky you!! > -- 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 [email protected]. To post to this group, send email to [email protected]. 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/bab9f4af-6208-401f-9021-e85cedf56b69%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

