mydict = {\"key1\":\"value1\", \"key2\":\"value2\"}
The regular way to lookup a dictionary value in a Django template is {{ mydict.key1 }}
Since I can't comment, let me do this in the form of an answer:
to build on culebrón's answer or Yuji 'Tomita' Tomita's answer, the dictionary passed into the function is in the form of a string, so perhaps use ast.literal_eval to convert the string to a dictionary first, like in this example.
With this edit, the code should look like this:
# code for custom template tag
@register.filter(name='lookup')
def lookup(value, arg):
value_dict = ast.literal_eval(value)
return value_dict.get(arg)
{{ mydict|lookup:item.name }}