feat: Add position property that returns coordinates
This commit is contained in:
parent
fb9ed07abc
commit
5d2e7c395f
@ -133,6 +133,13 @@ class AdoptionNotice(models.Model):
|
|||||||
def comments(self):
|
def comments(self):
|
||||||
return Comment.objects.filter(adoption_notice=self)
|
return Comment.objects.filter(adoption_notice=self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def position(self):
|
||||||
|
if self.location is None:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return (self.location.longitude, self.location.latitude)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
"""Returns the url to access a detailed page for the animal."""
|
"""Returns the url to access a detailed page for the animal."""
|
||||||
return reverse('adoption-notice-detail', args=[str(self.id)])
|
return reverse('adoption-notice-detail', args=[str(self.id)])
|
||||||
|
Loading…
Reference in New Issue
Block a user