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?
Se marcó esta pregunta
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?
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Registrarse| Publicaciones relacionadas | Respuestas | Vistas | Actividad | |
|---|---|---|---|---|
|
|
1
dic 15
|
7535 | ||
|
|
2
dic 25
|
4758 | ||
|
trying to match fields for products
Resuelto
|
|
2
mar 26
|
1346 | |
|
|
2
jul 25
|
3403 | ||
|
|
3
may 25
|
5174 |