Skip to content

Instantly share code, notes, and snippets.

@twidi
Created May 14, 2012 14:25
Show Gist options
  • Save twidi/2694305 to your computer and use it in GitHub Desktop.
Save twidi/2694305 to your computer and use it in GitHub Desktop.
Get a real dict from a django context (usefull when debugging)
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