summaryrefslogtreecommitdiff
path: root/app/locations/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/locations/models.py')
-rw-r--r--app/locations/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/locations/models.py b/app/locations/models.py
index ebac2e7..6745ff2 100644
--- a/app/locations/models.py
+++ b/app/locations/models.py
@@ -245,6 +245,12 @@ class Campsite(models.Model):
def lat(self):
'''Get the site's latitude.'''
return self.point.y
+
+ @property
+ def nights_stayed(self):
+ '''Get the number of nights we spent there '''
+ delta = self.date_left - self.date_arrived
+ return delta.days
def save(self, *args, **kwargs):
created = self.pk is None