It would be really useful to be able to use the new JSON type available in Postgresql 9.2+. Question is, which OpenERP field type would work with this? Can an OpenERP text field be used for this type?
Cette question a été signalée
It really depends on how you want to use the field. If the data in the field won't be used very often then you might want to just use a text field and create a materialized view based on the data in the column that has your JSON, but converted to a Postgres JSON field. This will allow you to index by JSON nodes and get more out of Postgres' JSON support.
If you don't need all the JSON support features from Postgres then ignore everything above and just use a Text field.
And how exactly you do "but converted to a Postgres JSON field" part ?
I am not talking about how to convert a dict into a JSON but about actual DB field type
You need to:
1. define a custom field type
2. use it on your model
3. make it work in the ui (view/edit)
Check out this gist on how I managed to do it: https://gist.github.com/danmana/5242f37b7d63daf4698de7c61c8b59fc#file-json_field-py
Dan Manastireanu how do you display the json field using your code from github?
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrire| Publications associées | Réponses | Vues | Activité | |
|---|---|---|---|---|
|
|
1
déc. 15
|
7531 | ||
|
|
2
déc. 25
|
4731 | ||
|
|
2
mars 26
|
1335 | ||
|
|
2
juil. 25
|
3391 | ||
|
|
3
mai 25
|
5153 |