You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have ["HH"] stored in a jsonfield, when I edit the corresponding model, using django-prettyjson shows it with backslashes in attached screenshot
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
The text was updated successfully, but these errors were encountered:
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.
If I have ["HH"] stored in a jsonfield, when I edit the corresponding model, using django-prettyjson shows it with backslashes in attached screenshot
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
The text was updated successfully, but these errors were encountered: