feat: Display only domain for further information link

This commit is contained in:
moanos [he/him] 2024-05-31 15:47:22 +02:00
parent c0a89c266a
commit 8c69bb8717
2 changed files with 8 additions and 1 deletions

View File

@ -191,6 +191,13 @@ class AdoptionNotice(models.Model):
distance = geo.calculate_distance_between_coordinates(self.position, position) distance = geo.calculate_distance_between_coordinates(self.position, position)
return distance < max_distance return distance < max_distance
@property
def link_to_more_information(self):
from urllib.parse import urlparse
domain = urlparse(self.further_information).netloc
return f"<a href='{self.further_information}'>{domain}</a>"

View File

@ -27,7 +27,7 @@
<td>{{ adoption_notice.searching_since }}</td> <td>{{ adoption_notice.searching_since }}</td>
{% if adoption_notice.further_information %} {% if adoption_notice.further_information %}
<td>{{ adoption_notice.further_information }}</td> <td>{{ adoption_notice.link_to_more_information | safe }}</td>
{% else %} {% else %}
<td>-</td> <td>-</td>
{% endif %} {% endif %}