Changes between Initial Version and Version 1 of Ticket #27183, comment 6
- Timestamp:
- Apr 8, 2017, 6:06:12 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #27183, comment 6
initial v1 3 3 I have the field declared on my like like so: 4 4 5 {{{ 6 from django.contrib.postgres.fields import JSONField 5 7 6 from django.contrib.postgres.fields import JSONField7 8 class FeedStatus(models.Model) 9 #..... 8 10 data = JSONField(default=dict) 11 #..... 12 }}} 9 13 14 When I try to access `feed_status.data` -- it returns JSON as a string (ie `"{}"` instead of `{}`}. Each time the object is saved, the empty string is re-serialized (ie `'"\\"{}\\""'`). 10 15 11 When I try to access `feed_status.data` -- it returns JSON as a string (ie "{}" instead of {}}. Each time the object is saved, the empty string is re-serialized (ie '"\\"{}\\""'). 12 13 ``` 16 {{{ 14 17 In 18:44:50 [30]: f = FeedStatus.objects.get(pk=25806) 15 18 … … 43 46 In 18:45:23 [43]: f.data 44 47 Out 18:45:23 [43]: '"\\"\\\\\\"{}\\\\\\"\\""' 45 ``` 48 }}} 46 49 47 50 This of course leads to incredibly bloated columns in the database (I've found some that are 10's of MB in size when they should just be a blank dict!!!)