Re: Appending new data to existing field of Json data type

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Appending new data to existing field of Json data type
Дата
Msg-id 5452497D.9010106@aklaver.com
обсуждение исходный текст
Ответ на Re: Appending new data to existing field of Json data type  (VENKTESH GUTTEDAR <venkteshguttedar@gmail.com>)
Список pgsql-general
On 10/29/2014 11:26 PM, VENKTESH GUTTEDAR wrote:
> @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.?

Sure, how you would normally update a value. Assuming id is unique:

id2 = ExampleTable.objects.get(id=2)

id2.example_list

You now have the example_list and you can do what you want with it. What
that is depends on what field type you have declared example_list in
your model? That is why I suggested the jsonfield in a previous post, it
automatically converts Python data structures into JSON and the reverse.

Then:

id2.save()

In your Django project I would crank up:

python manage.py shell

and work with the model directly to see what is happening.



>

> --
> Regards :
> Venktesh Guttedar.
>


--
Adrian Klaver
adrian.klaver@aklaver.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Unexpected planner behavior with *_pattern_ops index matching
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Appending new data to existing field of Json data type