Opened 6 years ago
Closed 6 years ago
#29473 closed Bug (needsinfo)
Postgres JSONField escaping to infinity on each save
Reported by: | Laurynas Riliskis | Owned by: | |
---|---|---|---|
Component: | contrib.postgres | Version: | 2.0 |
Severity: | Normal | Keywords: | postgress JSONFields |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
postgress JSONFields are escaping to infinity as you can see in the input below. The same behavior is reproduced through the admin interface.
I commented in bug https://code.djangoproject.com/ticket/26110 but not sure if the issue if the same.
import uuid from django.db import models from django.contrib.postgres.fields import JSONField class PublishedConsent(models.Model): uuid = models.UUIDField( default=uuid.uuid4, editable=False) json = JSONField()
>>> p = JSONTest.objects.get(instance="4550d7f3a28c4081af5b3ff5ac62ab60") >>> p.data '{}' >>> p.save() >>> p = JSONTest.objects.get(instance="4550d7f3a28c4081af5b3ff5ac62ab60") >>> p.data '"{}"' >>> p.save() >>> p = JSONTest.objects.get(instance="4550d7f3a28c4081af5b3ff5ac62ab60") >>> p.data '"\\"{}\\""' >>> p.save() >>> p = JSONTest.objects.get(instance="4550d7f3a28c4081af5b3ff5ac62ab60") >>> p.data '"\\"\\\\\\"{}\\\\\\"\\""'
Change History (2)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
You are using Django 2.0? I can't reproduce with this test case for
tests/postgres_tests/test_json.py
:Does that pass for you? Can you provide a failing test for Django's test suite?