python - How to access all dictionary keys in template -


i passing dictionary below template:

mydict={6:"a",9:"b"} 

now want check in template if particular value in dictionary key.something like:

{% if in mydict.items.keys %} ok {% endif %} 

i want display "ok" if either 6 or 9, above syntax not work.

thanks.

check without using items.keys, just

{% if in mydict %} ok {% endif %} 

or, if want use keys

{% if in mydict.keys %} ok {% endif %} 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -