1👍
Use the json
module, ex:
import json
obj = json.loads("{'value': 'UMMC', 'id': 'ef688c440131f59262f2c4f80d001c87', 'key': 'ef688c440131f59262f2c4f80d001c87'}")
# now obj["value"] == "UMMC";
0👍
Thanks every one for the help.
In my views.py I had the following:
projects = db.view('projects/name')
and I was trying to display the content of the ‘value’ attribute in my django template base_site.html
{'value': 'UMMC', 'id': 'ef688c440131f59262f2c4f80d001c87', 'key': 'ef688c440131f59262f2c4f80d001c87'}
so I did:
{%for p in projects%}
<td>{{p.value }} </td>
{% endfor %}
And it displayed exactly the content of ‘value’ attribute,
Again thanks so much, your feedback really guided me.
- [Answer]-Closing a Django Popuup
- [Answer]-Why doesn't Django serialize full model relations?
- [Answer]-Django 1.4.5 – Failed to install index for WorldBorder model
- [Answer]-How to make equations in views.py with a model field (beginner)
Source:stackexchange.com