feat: make display of location nicer

This commit is contained in:
moanos [he/him] 2025-05-09 21:03:21 +02:00
parent eb930b71d6
commit 8641bead80

View File

@ -58,7 +58,10 @@ class Location(models.Model):
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
def __str__(self): def __str__(self):
return f"{self.name} ({self.latitude:.5}, {self.longitude:.5})" if self.city and self.postcode:
return f"{self.city} ({self.postcode})"
else:
return f"{self.name} ({self.latitude:.5}, {self.longitude:.5})"
@property @property
def position(self): def position(self):