diff --git a/pgweb/settings.py b/pgweb/settings.py index 2518ccfb..d7c88b84 100644 --- a/pgweb/settings.py +++ b/pgweb/settings.py @@ -70,6 +70,12 @@ TEMPLATE_DIRS = ( '../templates/', ) +TEMPLATE_CONTEXT_PROCESSORS = ( + 'django.core.context_processors.auth', + 'django.core.context_processors.media', + 'util.contexts.RootLinkContextProcessor', +) + LOGIN_URL='/account/login/' LOGIN_REDIRECT_URL='/account/' LOGOUT_URL='/account/logout/' @@ -95,6 +101,8 @@ INSTALLED_APPS = [ ] +SITE_ROOT="http://www.postgresql.org" + # Load local settings overrides from settings_local import * diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py index 07772912..eac85679 100644 --- a/pgweb/util/contexts.py +++ b/pgweb/util/contexts.py @@ -1,4 +1,5 @@ from django.template import RequestContext +from django.conf import settings # This is the whole site navigation structure. Stick in a smarter file? sitenav = { @@ -88,3 +89,13 @@ class NavContext(RequestContext): navsection = {} self.update({'navmenu': navsection}) + +# Template context processor to add information about the root link +def RootLinkContextProcessor(request): + if request.is_secure(): + return { + 'link_root': settings.SITE_ROOT, + } + else: + return {} + diff --git a/templates/base/base.html b/templates/base/base.html index c4d524e6..2a489288 100644 --- a/templates/base/base.html +++ b/templates/base/base.html @@ -7,8 +7,8 @@ - - + +