summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/locations/admin.py5
-rw-r--r--app/locations/models.py6
2 files changed, 9 insertions, 2 deletions
diff --git a/app/locations/admin.py b/app/locations/admin.py
index 5e4c905..f185e97 100644
--- a/app/locations/admin.py
+++ b/app/locations/admin.py
@@ -248,7 +248,7 @@ class CheckInAdmin(OLAdminBase):
@admin.register(Campsite)
class CampsiteAdmin(OLAdminBase):
form = LGEntryForm
- list_display = ('name', 'location', 'date_arrived', 'campsite_type',)
+ list_display = ('name', 'location', 'date_arrived', 'date_left', 'campsite_type', 'campsite_price', 'nights_stayed')
list_filter = ('date_arrived', 'campsite_type')
search_fields = ['location__name', ]
fieldsets = (
@@ -257,8 +257,9 @@ class CampsiteAdmin(OLAdminBase):
'name',
('date_arrived', 'date_left'),
'campsite_type',
- 'body_markdown'
+ 'body_markdown',
'point',
+ 'campsite_price',
'campsite_number',
'campsite_we_wish_we_had',
),
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