feat: Use truncated location

This commit is contained in:
moanos [he/him] 2024-11-08 07:42:34 +01:00
parent 9f977e35c2
commit c3dd9faa85
3 changed files with 6 additions and 2 deletions

View File

@ -121,6 +121,10 @@ class Location(models.Model):
def __str__(self):
return f"{self.name} ({self.latitude:.5}, {self.longitude:.5})"
@property
def str_hr(self):
return f"{self.name.split(',')[0]}"
@staticmethod
def get_location_from_string(location_string):
geo_api = geo.GeoAPI()

View File

@ -12,7 +12,7 @@
<p>
<b>Ort</b>
{% if adoption_notice.location %}
{{ adoption_notice.location }}
{{ adoption_notice.location.str_hr }}
{% else %}
{{ adoption_notice.location_string }}
{% endif %}

View File

@ -14,7 +14,7 @@
<p>
<b>Ort</b>
{% if adoption_notice.location %}
{{ adoption_notice.location }}
{{ adoption_notice.location.str_hr }}
{% else %}
{{ adoption_notice.location_string }}
{% endif %}