↧
Answer by Adem Öztaş for Django template - dynamic variable name
You can try like this, {{ dict|key:key_name }}Filter:def key(d, key_name): return d[key_name]key = register.filter('key', key)More information, django ticket
View ArticleAnswer by Joe for Django template - dynamic variable name
You're best off writing your own custom template tag for that. It's not difficult to do, and normal for this kind of situation.I have not tested this, but something along these lines should work....
View ArticleDjango template - dynamic variable name
Good Afternoon,How can I use a variable variable name in Django templates?I have a custom auth system using context, has_perm checks to see if the user has access to the specified section.deptauth is a...
View Article