Created
May 14, 2012 14:25
-
-
Save twidi/2694305 to your computer and use it in GitHub Desktop.
Get a real dict from a django context (usefull when debugging)
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
def context2dict(context): | |
result = {} | |
for dic in reversed(context.dicts): | |
try: | |
result.update(dic) | |
except: | |
try: | |
result.update(context2dict(dic)) | |
except: | |
pass | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment