This happens because of the way the Django template language does variable
lookups.
When you try to loop through the dictionaries items,
{% for key, value in /confirm/ilist.items %}Django first does a dictionary lookup for
/confirm/ilist['items']. As this is a
defaultdict, an empty list is returned.
It’s a cruel gotcha, that I’ve been stung by as well!
To work around this problem, convert your defaultdict into a dictionary before
adding it to the template context.
context['/confirm/ilist'] = dict(/confirm/i_list)
Or, as explained by sebastien trottier in his his answer to a similar
question, set
default_factory
to
Nonebefore adding to the template context.
/confirm/i_list.default_factory = Nonecontext['/confirm/ilist'] = /confirm/i_list


![My defaultdict(list) won't show up on template but does in my view [duplicate] My defaultdict(list) won't show up on template but does in my view [duplicate]](http://www.mshxw.com/aiimages/31/646120.png)
