django-prettyjson
django-prettyjson copied to clipboard
edit format needed without quotes
If I have ["HH"] stored in a jsonfield, when I edit the corresponding model, using django-prettyjson shows it with backslashes in attached screenshot
![screen shot 2018-07-07 at 6 56 51 pm](https://user-images.githubusercontent.com/15010133/42411351-e9af4ce6-8217-11e8-986f-e5f3a9bcb638.png)
When user saves the same string again, the backslashes become part of the json data. This means everytime a user clicks on change form to edit some other field, the json field will continue to get backslashes added.
This is not a good experience. Ideally, there should be a conversion to show string without backslashes to the user
Thanks for the report!
-
Are you trying to store the array
["HH"]
or the string"[\"HH\"]"
? -
I can't replicate the specific behavior you're describing. In the admin interface, I enter
"[\"HH\"]"
, save, edit some other other field, save again, and do not see additional backslashes added (like"[\\\"HH\\\"]"
) -- I just continue to see"[\"HH\"]"
. What versions are you using for django and this package? Are you using additional packages or custom forms in your admin? -
I do see a difference between the admin widget and a widget in a template, where the admin has
"[\"HH\"]"
and the template is showing["HH"]
, so I'll have to think through whether consistency is needed and what should be happening.