The following template is not outputting anything despite there being data.
My question is... is there I was I can dump out into the template the content of 'points' object just so I can see what is in it?
template.py
<h3>{% trans "Points" %}</h3>
{% if points %}
<p>{% trans "Total Points" %}: {{ points.Points }}</p>
<table>
<thead>
<tr>
<th>{% trans "Transaction" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Points" %}</th>
</tr>
</thead>
<tbody>
{% for item in points.Points_items.all %}
<tr>
<td>{{ item.transaction_description }}</td>
<td>{{ item.get_status_display }}</td>
<td>{{ item.points }}</td>
</tr>
{% endfor %}
</tbody>
</table>
I use a custom tag for this:
# Custom tag for diagnostics
@register.simple_tag()
def debug_object_dump(var):
return vars(var)
And
{% load extra_tags %}
...
{% for thing in things %}
<pre>{% debug_object_dump thing %}</pre>
{% endfor %}
Stick this at the top:
<h1>|{{ points }}|</h1>
If there's nothing between the |
then it's empty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With