From 8c69bb871739b1b71dc8e799b186c6b1297201f3 Mon Sep 17 00:00:00 2001 From: moanos Date: Fri, 31 May 2024 15:47:22 +0200 Subject: [PATCH] feat: Display only domain for further information link --- src/fellchensammlung/models.py | 7 +++++++ .../fellchensammlung/details/detail_adoption_notice.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index 1d397be..ad7a91d 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -191,6 +191,13 @@ class AdoptionNotice(models.Model): distance = geo.calculate_distance_between_coordinates(self.position, position) return distance < max_distance + @property + def link_to_more_information(self): + from urllib.parse import urlparse + + domain = urlparse(self.further_information).netloc + return f"{domain}" + diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html b/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html index 29b60a8..7f78d5e 100644 --- a/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html +++ b/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html @@ -27,7 +27,7 @@ {{ adoption_notice.searching_since }} {% if adoption_notice.further_information %} - {{ adoption_notice.further_information }} + {{ adoption_notice.link_to_more_information | safe }} {% else %} - {% endif %}