@Adrian Klaver, Thanks for this idea but still m really confused with how to update the json filed in the DB. is there any way to update the json field in the DB through view.?
On Wed, Oct 29, 2014 at 7:37 PM, Adrian Klaver <adrian.klaver@xxxxxxxxxxx> wrote:
If it where me I would bring the data into the view and do the work there in Python using dicts and lists. There is a Python module out there that make this easier to do:On 10/29/2014 01:06 AM, VENKTESH GUTTEDAR wrote:
Ya agreed thats not legal JSON, that was typing mistake sorry for that,
let me make you clear what i need exactly,
I have table named (exampleTable) with json field as (example_list), and
when i say
SELECT * FROM exampleTable;
id | example_list
---+----------------------------------------------
2 | {"abc":[ { "a":"b","c":"d" } ] }
And this data i am inserting through DJango view by writing the
following statement
test = ExampleTable(id = 2, example_list = {"abc" : [ { "a":"b","c":"d"
} ] })
test.save()
now i want to append { "e":"f", "g":"h" } to example_list by specifying
the id.
and after appending the data should be stored in the following way :
After appending,
for example if i say :
SELECT * FROM exampleTable;
i should get this.
id | example_list
---+--------------------------------------------------------
2 | {"abc":[ { "a":"b","c":"d" }, { "e":"f", "g":"h" } ] }
Hope your clear now.
So now Guide me to append it through Python Djnago View. or through raw
sql query.
https://pypi.python.org/pypi/django-jsonfield
--
Regards :
Venktesh Guttedar.
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx
--
Regards :
Venktesh Guttedar.