1👍
There may not be any data in the database. Try this.
{% if table|length %}
{% for key, value in table.items %}
<p> {{ key }} : {{ value }}</p>
{% endfor %}
{% else %}
<div>There are no data in the database</div>
{% endif %}
0👍
I was rendering the database values wrongly on the template , this is how it should be done for a list of dictionary
{% for x in table %}
{% for key,values in x.items %}
<p> {{key}} : {{values}} </p>
{% endfor %}
{% endfor %}
- [Answer]-How to enforce that only a single object, out of all objects, of a Model has a specified value for a field
- [Answer]-Pydev Django1.4 ImportError
- [Answer]-Backbone.js appending [] to key name on fetch
- [Answer]-Field in the model does not change in django app
Source:stackexchange.com