diff --git a/backend/donations/views/ngo.py b/backend/donations/views/ngo.py index 02ec86eb..a9ca54e2 100644 --- a/backend/donations/views/ngo.py +++ b/backend/donations/views/ngo.py @@ -9,7 +9,7 @@ from django.shortcuts import redirect, render from django.urls import reverse from django.utils import timezone -from django.utils.translation import gettext as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import TemplateView from ipware import get_client_ip diff --git a/backend/redirectioneaza/settings.py b/backend/redirectioneaza/settings.py index 10b1c2ae..a4077efa 100644 --- a/backend/redirectioneaza/settings.py +++ b/backend/redirectioneaza/settings.py @@ -20,8 +20,8 @@ import environ import sentry_sdk from cryptography.fernet import Fernet -from django.urls import reverse_lazy from django.templatetags.static import static +from django.urls import reverse_lazy from django.utils import timezone from localflavor.ro.ro_counties import COUNTIES_CHOICES @@ -189,18 +189,20 @@ # some settings will be different if it's not running in a container (e.g., locally, on a Mac) IS_CONTAINERIZED = env.bool("IS_CONTAINERIZED") +DEFAULT_REVISION_STRING = "dev" + VERSION = env.str("VERSION", "edge") -REVISION = env.str("REVISION", "develop") +REVISION = env.str("REVISION", DEFAULT_REVISION_STRING) +REVISION = REVISION[:7] -if IS_CONTAINERIZED and VERSION == "edge" and REVISION == "develop": +if IS_CONTAINERIZED and VERSION == "edge" and REVISION == DEFAULT_REVISION_STRING: version_file = "/var/www/redirect/.version" if os.path.exists(version_file): with open(version_file) as f: VERSION, REVISION = f.read().strip().split("+") -REVISION = REVISION[:7] - -VERSION_SUFFIX = f"redirect@{VERSION}+{REVISION}" +VERSION_SUFFIX = f"{VERSION}+{REVISION}" +VERSION_LABEL = f"redirect@{VERSION_SUFFIX}" # Sentry @@ -216,7 +218,7 @@ # We recommend adjusting this value in production. profiles_sample_rate=env.float("SENTRY_PROFILES_SAMPLE_RATE"), environment=ENVIRONMENT, - release=VERSION_SUFFIX, + release=VERSION_LABEL, ) @@ -612,9 +614,10 @@ CONTACT_EMAIL_ADDRESS = env.str("CONTACT_EMAIL_ADDRESS") # Unfold Admin settings +# https://unfoldadmin.com/docs/configuration/settings/ +# Supported icon set: https://fonts.google.com/icons UNFOLD = { "SITE_TITLE": TITLE, - "SITE_HEADER": f"Admin | {VERSION_SUFFIX}", "SITE_ICON": lambda request: static("images/logo-smaller.png"), "SITE_LOGO": lambda request: static("images/logo-smaller.png"), "SITE_FAVICONS": [ diff --git a/backend/redirectioneaza/urls.py b/backend/redirectioneaza/urls.py index 597df366..5fe67309 100644 --- a/backend/redirectioneaza/urls.py +++ b/backend/redirectioneaza/urls.py @@ -62,7 +62,7 @@ ) from redirectioneaza.views import StaticPageView -admin.site.site_header = f"Admin | {settings.VERSION_SUFFIX}" +admin.site.site_header = f"Admin | {settings.VERSION_LABEL}" urlpatterns = (