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

java - Null response to php query in android, even though php works properly -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -