Add a template context processor that sets link_root on all secure requests,

so that we can generate proper linkbacks to the non-secure version of the
site for all static content.
This commit is contained in:
Magnus Hagander
2009-09-16 16:08:17 +02:00
parent 4be5cd0266
commit df91488ae6
3 changed files with 31 additions and 12 deletions

View File

@ -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 {}