1

I have a dictionary

>>> filterdata {u'data': [{u'filter': u'predictions', u'filtervalue': u'32', u'filterlevel': u'cltv', u'filtertype': u'>'}, {u'filter': u'profile', u'filtervalue': u"'TOMMY'", u'filterlevel': u'firstname', u'filtertype': u'='}]} 

and i am using this to in django template

 {% for c in filterdata.data %} {{c}} ## print the current iterating dictionay {% for d in c.items %} {{ d.filtervalue }} ## does not print anything {% endfor %} {% endfor %} 

any idea what i am doing wrong

1 Answer 1

1

You're iterating too much. d is the set of key-value pairs in the dict; filteritems is one of those keys, not an attribute of the pairs themselves. Remove that inner loop.

{% for c in filterdata.data %} {{ c.filtervalue }} {% endfor %} 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.