summaryrefslogtreecommitdiff
path: root/app/locations/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/locations/views.py')
-rw-r--r--app/locations/views.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/app/locations/views.py b/app/locations/views.py
index 3a93c0d..48ecc07 100644
--- a/app/locations/views.py
+++ b/app/locations/views.py
@@ -8,8 +8,8 @@ from django.db.models import Q
from jrnl.models import Entry
from projects.shortcuts import render_to_geojson
from sightings.models import Sighting
-
-from .models import Country, Region, Route, Location
+from utils.views import PaginatedListView
+from .models import Country, Region, Route, Location, Walk
def map_list(request):
context = {
@@ -99,3 +99,25 @@ class LocationDetail(DetailView):
Q(location__in=Location.objects.filter(parent=self.get_object()))
).order_by('ap_id', 'ap__apclass__kind').distinct("ap")
return context
+
+
+class WalkDetail(DetailView):
+ model = Walk
+
+ def get_context_data(self, **kwargs):
+ context = super(WalkDetail, self).get_context_data(**kwargs)
+ context['entry_list'] = Entry.objects.filter(
+ Q(location=self.get_object().location) |
+ Q(location__in=Location.objects.filter(parent=self.get_object().location))
+ )
+ context['wildlife'] = Sighting.objects.filter(
+ Q(location=self.get_object().location) |
+ Q(location__in=Location.objects.filter(parent=self.get_object().location))
+ ).order_by('ap_id', 'ap__apclass__kind').distinct("ap")
+ return context
+
+class WalkList(PaginatedListView):
+ """
+ Return list of Walks
+ """
+ model = Walk