2021-03-08 16:49:10 +00:00
|
|
|
""" customize the info available in context for rendering templates """
|
2021-05-28 15:00:07 +00:00
|
|
|
from bookwyrm import models, settings
|
2020-12-11 20:31:02 +00:00
|
|
|
|
2021-03-08 16:49:10 +00:00
|
|
|
|
|
|
|
def site_settings(request): # pylint: disable=unused-argument
|
2021-04-26 16:15:42 +00:00
|
|
|
"""include the custom info about the site"""
|
2021-05-28 15:00:07 +00:00
|
|
|
request_protocol = "https://"
|
|
|
|
if not request.is_secure():
|
|
|
|
request_protocol = "http://"
|
2021-05-26 16:20:22 +00:00
|
|
|
|
2021-05-19 20:56:00 +00:00
|
|
|
return {
|
|
|
|
"site": models.SiteSettings.objects.get(),
|
2021-05-19 22:17:32 +00:00
|
|
|
"active_announcements": models.Announcement.active_announcements(),
|
2021-05-28 15:00:07 +00:00
|
|
|
"media_path": settings.MEDIA_PATH,
|
|
|
|
"preview_images_enabled": settings.ENABLE_PREVIEW_IMAGES,
|
2021-05-26 16:20:22 +00:00
|
|
|
"request_protocol": request_protocol,
|
2021-05-19 20:56:00 +00:00
|
|
|
}
|