Created
August 11, 2011 11:36
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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