Django shell command to change a value in json data
Posted
by
crozzfire
on Stack Overflow
See other posts from Stack Overflow
or by crozzfire
Published on 2014-06-05T21:07:15Z
Indexed on
2014/06/05
21:24 UTC
Read the original article
Hit count: 170
I am a django newbie and i was playing around in django's manage.py shell. Here is something i am trying in the shell:
>>> data
[{'primary_program': False, 'id': 3684}, {'primary_program': True, 'id': 3685}]
>>> data[0]
{'primary_program': False, 'id': 3684}
>>> data[1]
{'primary_program': True, 'id': 3685}
>>> data[0].values()
[False, 3684]
>>> data[1].values()
[True, 3685]
>>>
How should i give a command here to update the value of primary_program
in data[1]
to False and keep the rest of the json the same?
© Stack Overflow or respective owner