Hi,
I am reading data from an API… and in the json it returns, some fields start with an underscore.
"_links": {
"next": "/wiki/api/v2/spaces?cursor=eyJpZCI6NTIxOTk0MjcsInNwYWNlU29ydE9yZGVyIjp7ImZpZWxkIjoiSUQiLCJkaXJlY3Rpb24iOiJBU0NFTkRJTkcifSwic3BhY2VTb3J0T3JkZXJWYWx1ZSI6NTIxOTk0Mjd9",
"base": "https://elkvalleyresources.atlassian.net/wiki"
}
Here is how I defined my function in the views.py file
resp = requests.request("Get",uri, headers=headers, auth=userauth)
response = resp.json()
return render(request, 'spaces.html', {'response':response})
Here is how I display in the template.
{% for i in response.results %}
<tr>
<td>{{i.name}}</td>
<td>{{i.type}}</td>
<td>{{i.status}}</td>
<td>{{i.createdAt}}</td>
<td>{{i.id}}</td>
<td>{{i.key}}</td>
<td><a href="https://elkvalleyresources.atlassian.net/wiki">{{i.name}}</a> </td>
</tr>
{% endfor %}
but response._links.next
fails with error: Variables and attributes may not begin with underscores: ‘response._links.next’
Also tried response['_links']['next']
, also fails.
any help would be greatly appreciated.
thanks.
NG.