Skip to content

Instantly share code, notes, and snippets.

@vladimiroff
Created August 11, 2011 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladimiroff/1139446 to your computer and use it in GitHub Desktop.
Save vladimiroff/1139446 to your computer and use it in GitHub Desktop.
Returns the value of given key in dict or... something like a dict
# -*- coding: utf-8 -*-
from django import template
register = template.Library()
@register.filter
def hash(name, key):
'''
Returns the value of given key
in dict or... something like a dict
'''
return dict(name)[key]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment