diff --git a/src/fellchensammlung/templates/fellchensammlung/base_generic.html b/src/fellchensammlung/templates/fellchensammlung/base_generic.html index aa9c402..dd2da24 100644 --- a/src/fellchensammlung/templates/fellchensammlung/base_generic.html +++ b/src/fellchensammlung/templates/fellchensammlung/base_generic.html @@ -1,3 +1,4 @@ +{% load custom_tags %}
@@ -14,7 +15,7 @@ - + {% get_oxitraffic_script_if_enabled %} {% block header %} diff --git a/src/fellchensammlung/templatetags/custom_tags.py b/src/fellchensammlung/templatetags/custom_tags.py index 7ea7f75..6e4b976 100644 --- a/src/fellchensammlung/templatetags/custom_tags.py +++ b/src/fellchensammlung/templatetags/custom_tags.py @@ -3,6 +3,7 @@ import markdown from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe +from notfellchen import settings register = template.Library() @@ -30,6 +31,7 @@ def join_link(value, arg): def get_type(value): return type(value) + @register.filter @stringfilter def render_markdown(value): @@ -37,3 +39,11 @@ def render_markdown(value): html = md.convert(value) return mark_safe(html) + + +@register.simple_tag +def get_oxitraffic_script_if_enabled(): + if settings.OXITRAFFIC_ENABLED: + return mark_safe(f'') + else: + return "" diff --git a/src/notfellchen/settings.py b/src/notfellchen/settings.py index ed9991f..eda41eb 100644 --- a/src/notfellchen/settings.py +++ b/src/notfellchen/settings.py @@ -82,6 +82,10 @@ LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')] """ GEOCODING """ GEOCODING_API_URL = config.get("geocoding", "api_url", fallback="https://nominatim.hyteck.de/search") +""" OxiTraffic""" +OXITRAFFIC_ENABLED = config.get("tracking", "oxitraffic_enabled", fallback=False) +OXITRAFFIC_BASE_URL = config.get("tracking", "oxitraffic_base_url", fallback="") + """ E-MAIL """ console_only = config.getboolean("mail", "console_only", fallback="true") EMAIL_SUBJECT_PREFIX = config.get("mail", "prefix", fallback="[notfellchen]]")