From 7f41634987a91b69b7b3fcdd4d30e06f33e9d24f Mon Sep 17 00:00:00 2001 From: Mikkel Munch Mortensen <3xm@detfalskested.dk> Date: Sat, 23 Jun 2018 20:18:54 +0200 Subject: [PATCH] Add a context processor that includes current site --- membersystem/context_processors.py | 10 ++++++++++ membersystem/settings/base.py | 7 +++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 membersystem/context_processors.py diff --git a/membersystem/context_processors.py b/membersystem/context_processors.py new file mode 100644 index 0000000..31564b4 --- /dev/null +++ b/membersystem/context_processors.py @@ -0,0 +1,10 @@ +"""Context processors for the membersystem app.""" + +from django.contrib.sites.shortcuts import get_current_site + + +def current_site(request): + """Include the current site in the context.""" + return { + 'site': get_current_site(request) + } diff --git a/membersystem/settings/base.py b/membersystem/settings/base.py index 390e34f..13171ab 100644 --- a/membersystem/settings/base.py +++ b/membersystem/settings/base.py @@ -36,11 +36,13 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'django.contrib.sites', + 'membersystem', + 'profiles', + 'allauth', 'allauth.account', + 'allauth.socialaccount', 'django_extensions', - - 'profiles', ] MIDDLEWARE = [ @@ -66,6 +68,7 @@ TEMPLATES = [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', + 'membersystem.context_processors.current_site', ], }, },