2👍
✅
You can’t do this sort of indirect variable resolution in Django’s template language. It will always interpret e_quals.req_id
as e_quals["req_id"]
– ie as a literal key.
You’ll need to create a simple template filter:
@register.filter
def dict_get(my_dict, key):
return my_dict.get(key)
{{ e_quals|dict_get:req_id }}
Source:stackexchange.com