diff options
Diffstat (limited to 'app/jrnl')
-rw-r--r-- | app/jrnl/admin.py | 3 | ||||
-rw-r--r-- | app/jrnl/views.py | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/app/jrnl/admin.py b/app/jrnl/admin.py index 9a39114..e77b931 100644 --- a/app/jrnl/admin.py +++ b/app/jrnl/admin.py @@ -29,13 +29,12 @@ class EntryAdmin(OSMGeoAdmin): search_fields = ['title', 'body_markdown'] prepopulated_fields = {"slug": ('title',)} list_filter = ('pub_date', 'enable_comments', 'status', 'location__state__country__lux_region') - filter_horizontal = ('field_notes','books') + filter_horizontal = ('field_notes', 'books') fieldsets = ( ('Entry', { 'fields': ( 'title', 'body_markdown', - #'body_html', ('pub_date', 'status'), 'slug', 'point' 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 |