1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
wagtail-website-2018-spike/project/common/context.py

26 lines
471 B
Python
Raw Permalink Normal View History

2018-07-24 21:16:55 +01:00
from django.conf import settings
2018-07-26 09:22:19 +01:00
from project.home.models import HomePage
2018-07-24 21:16:55 +01:00
2018-07-27 21:37:11 +01:00
2018-07-24 21:16:55 +01:00
SETTINGS_KEYS = [
'BASE_URL',
'STATIC_URL',
'MEDIA_URL',
'LANGUAGE_CODE',
'TIME_ZONE',
'ALLOWED_HOSTS',
'WAGTAIL_SITE_NAME'
]
def settings_injector(request):
return {'settings': {
setting: getattr(settings, setting) for setting in SETTINGS_KEYS
}}
2018-07-26 09:22:19 +01:00
2018-07-27 21:37:11 +01:00
2018-07-26 09:22:19 +01:00
def get_home_page(request):
return {
'homepage': HomePage.objects.live().first()
}