# HG changeset patch # User rougeronj # Date 1418223068 -3600 # Node ID 4911075b6000b056aec829d991e94b9a99ffa1e1 # Parent 2de7d0f96813b54d687c8dc4f4b83fb25c513dd0 add context_processor and variable VERSION accessible from templates diff -r 2de7d0f96813 -r 4911075b6000 src/hdalab/context_processors.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdalab/context_processors.py Wed Dec 10 15:51:08 2014 +0100 @@ -0,0 +1,4 @@ +import hdalab + +def version(request): + return { 'VERSION': hdalab.get_version() } \ No newline at end of file diff -r 2de7d0f96813 -r 4911075b6000 src/hdalab/settings.py --- a/src/hdalab/settings.py Wed Dec 10 15:22:40 2014 +0100 +++ b/src/hdalab/settings.py Wed Dec 10 15:51:08 2014 +0100 @@ -114,6 +114,19 @@ 'django.contrib.messages.middleware.MessageMiddleware', ) +# List of processors used by RequestContext to populate the context. +# Each one should be a callable that takes the request object as its +# only parameter and returns a dictionary to add to the context. +TEMPLATE_CONTEXT_PROCESSORS = ( + 'django.contrib.auth.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.i18n', + 'django.core.context_processors.media', + 'django.core.context_processors.static', + 'django.contrib.messages.context_processors.messages', + 'hdalab.context_processors.version', +) + ROOT_URLCONF = 'hdalab.urls' TEMPLATE_DIRS = (