python - Django Dict of List Template -
this question has answer here:
- django template can't loop defaultdict 2 answers
i trying print out stuff dictionary of lists in django. here dict_:
defaultdict(<class 'list'>, {'uit energy producers class': [6, 3, '08-18-2017'], 'equity growth class': [18, 3, '08-18-2017'], 'unconstrained bond class': [13, 3, '08-18-2017']}) in views.py:
context['obj_items'] = dict_ return context then in templates.html:
{% key, value_list in obj_items.items %} {% value in value_list %} {{ value }} {% endfor %} {% endfor %} but nothing getting printed out. ideas?
use this:
dict(dict_) django template doesn't accept defaultdict
Comments
Post a Comment