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?
Pertanyaan ini telah diberikan tanda
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?
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar| Post Terkait | Replies | Tampilan | Aktivitas | |
|---|---|---|---|---|
|
|
1
Des 15
|
7418 | ||
|
|
2
Des 25
|
4501 | ||
|
trying to match fields for products
Diselesaikan
|
|
2
Mar 26
|
1181 | |
|
|
2
Jul 25
|
3226 | ||
|
|
3
Mei 25
|
4876 |