best_filters.get_key¶
-
best_filters.
get_key
(object, attr)¶ Give access to a dict value with a key contained in a var
Example :
>>> c = {'countries': {'FR':'France','US':'United States'}, ... 'country':'FR'} >>> t = '{% load best_filters %}Country:{{ countries|get_key:country }}' >>> Template(t).render(Context(c)) 'Country:France'