Skip to content

Instantly share code, notes, and snippets.

@omaraboumrad
Created December 20, 2012 08:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omaraboumrad/4343762 to your computer and use it in GitHub Desktop.
Save omaraboumrad/4343762 to your computer and use it in GitHub Desktop.
Django context processor
# in processor.py
def site_processor(request):
return {'Foo': 'Bar'}
# in settings.py
from django.conf import global_settings as DEFAULT_SETTINGS
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
'myapp.processor.site_processor',
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment