I can't get .items to work in my Django template:
copy and paste from my CBV's get_context_data:
context['data'] = assertion_dict
context['dataitems'] = assertion_dict.items()
return context
copy and paste from my template:
<h3>data dump</h3>
{{data}}
<h3>dataitems</h3>
{% for key, value in dataitems %}
{{ key }}: {{ value }} <br/>
{% endfor %}
<h3>data.items</h3>
{% for key, value in data.items %}
{{ key }}: {{ value }} <br/>
{% endfor %}
<h3>Not found test</h3>
{{ i_dont_exist }}
output:
**data dump**
defaultdict(<class 'list'>, {<BadgeType: Talent>: [<BadgeAssertion: Blender Blue Belt>], <BadgeType: Achievement>: [<BadgeAssertion: MyBadge#1>, <BadgeAssertion: MyBadge#1>, <BadgeAssertion: MyBadge#2>], <BadgeType: Award>: [<BadgeAssertion: Copy of Copy of Blenbade>]})
**dataitems**
Talent: [<BadgeAssertion: Blender Blue Belt>]
Achievement: [<BadgeAssertion: MyBadge#1>, <BadgeAssertion: MyBadge#1>, <BadgeAssertion: MyBadge#2>]
Award: [<BadgeAssertion: Copy of Copy of Blenbade>]
**data.items**
**Not found test**
DEBUG WARNING: undefined template variable [i_dont_exist] not found
Why isn't the second version working, where I use data.items in my template?