Source code for thaliawebsite.context_processors
"""These context processors can be used to expand the context provided to views."""
from django.conf import settings
from django.utils import timezone
[docs]def source_commit(_):
"""Get the SOURCE_COMMIT environment variable."""
return {"SOURCE_COMMIT": settings.SOURCE_COMMIT}
[docs]def thumbnail_sizes(_):
"""Get the defined sizes for thumbnails."""
return {
"THUMBNAIL_SIZE_SMALL": settings.THUMBNAIL_SIZES["small"],
"THUMBNAIL_SIZE_MEDIUM": settings.THUMBNAIL_SIZES["medium"],
"THUMBNAIL_SIZE_LARGE": settings.THUMBNAIL_SIZES["large"],
}
[docs]def lustrum_styling(_):
"""Whether to enable the lustrum styling."""
return {
"lustrumstyling": timezone.now().date() == timezone.datetime(2020, 11, 7).date()
or settings.LUSTRUM_STYLING
}