2👍
smsreport_dict
should be inside the Context
you use in order to render the template:
...
html = t.render(Context({"smsreport_dict": smsreport_dict}))
...
Plus, you forgot to call .items
when iterating through the dict in the template:
{% for key, value in smsreport_dict.items %}
...
0👍
You need to add .items
to smsreport_dict
MSGID: {{ msgid }}
<p> Begin
{% for key, value in smsreport_dict.items %}
<tr>
<td> Key: {{ key }} </td>
</tr>
{% endfor %}
</p>End
See here for a similar situation.
Source:stackexchange.com