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?
This question has been flagged
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?
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up| Related Posts | Replies | Views | Activity | |
|---|---|---|---|---|
|
|
1
Dec 15
|
7374 | ||
|
|
2
Dec 25
|
4399 | ||
|
|
2
Mar 26
|
1067 | ||
|
|
2
Jul 25
|
3147 | ||
|
|
3
May 25
|
4732 |