#27538: Value of JSONField is being re-encoded to string even though being 
already
encoded
----------------------------------+--------------------------------------
     Reporter:  Petar Aleksic     |                    Owner:  (none)
         Type:  Bug               |                   Status:  new
    Component:  contrib.postgres  |                  Version:  1.10
     Severity:  Normal            |               Resolution:
     Keywords:  JSONField         |             Triage Stage:  Unreviewed
    Has patch:  0                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+--------------------------------------
Changes (by Waken Meng):

 * status:  closed => new
 * resolution:  worksforme =>


Comment:

 I have the same problem, Re-json the JSONField value.


 {{{
 from django.contrib.postgres.fields import JSONField

 class Foo(models.Model):
     photos = JSONFields(max_length=300)

 >>f = Foo()
 >>f.photos = []
 >>f.save()
 >>f.photos
 u'[]'

 >>f.save()
 >>f.refresh_from_db()
 >>f.photos
 u'"[]"'

 >>f.save()
 >>f.refresh_from_db()
 >>f.photos
 u'"\\"[]\\""'

 }}}
 Above was in manage.py shell, and everytime I save the instance, the
 JSONField value is re-jsonized.

 env:
  postgres 9.6.1
  python 2.7.12

  django 1.10.5
  psycopg2 2.6.2

--
Ticket URL: <https://code.djangoproject.com/ticket/27538#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.b06fffefd73816f2814347464edbf4ed%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to