diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html b/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html index 58a175f..e90b8b3 100644 --- a/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html +++ b/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html @@ -48,7 +48,14 @@ {{ adoption_notice.searching_since }} {{ adoption_notice.last_checked | date:'d. F Y' }} {% if adoption_notice.further_information %} - {{ adoption_notice.link_to_more_information | safe }} + +
+ + +
+ {% else %} - {% endif %} diff --git a/src/fellchensammlung/templatetags/custom_tags.py b/src/fellchensammlung/templatetags/custom_tags.py index 69740db..ae04582 100644 --- a/src/fellchensammlung/templatetags/custom_tags.py +++ b/src/fellchensammlung/templatetags/custom_tags.py @@ -4,6 +4,7 @@ from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from notfellchen import settings +from urllib.parse import urlparse register = template.Library() @@ -56,6 +57,17 @@ def pointdecimal(value): except ValueError: return value +@register.filter +@stringfilter +def domain(url): + try: + domain = urlparse(url).netloc + if domain.startswith("www."): + return domain[4:] + return domain + except ValueError: + return url + @register.simple_tag def settings_value(name): return getattr(settings, name)