mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-13 13:12:42 +00:00
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:
@ -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 {}
|
||||
|
||||
|
Reference in New Issue
Block a user