diff options
Diffstat (limited to 'app/jrnl/views.py')
-rw-r--r-- | app/jrnl/views.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/jrnl/views.py b/app/jrnl/views.py index 01167db..94d887c 100644 --- a/app/jrnl/views.py +++ b/app/jrnl/views.py @@ -4,11 +4,12 @@ from django.views.generic.dates import YearArchiveView, MonthArchiveView from django.contrib.syndication.views import Feed from django.shortcuts import get_object_or_404 from django.conf import settings +from django.db.models import Q from utils.views import PaginatedListView from .models import Entry, HomepageCurrator -from locations.models import CheckIn, Country, Region +from locations.models import CheckIn, Country, Region, Location from sightings.models import Sighting @@ -82,7 +83,10 @@ class EntryDetailView(DetailView): def get_context_data(self, **kwargs): context = super(EntryDetailView, self).get_context_data(**kwargs) - context['wildlife'] = Sighting.objects.filter(location=self.get_object().location).order_by('ap_id', 'ap__apclass__kind').distinct("ap") + 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 |