summaryrefslogtreecommitdiff
path: root/app/jrnl/views.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2018-05-05 22:21:59 -0400
committerluxagraf <sng@luxagraf.net>2018-05-05 22:21:59 -0400
commit1ac6c0b6fb2f0e0f8a92fbedf39eb39e7fa7676f (patch)
tree83e8eb17793413d6379c3721a60507887e3373e6 /app/jrnl/views.py
parent6cfbc4ed9a70b8fbfdd08294ae35a7bf36e95ac8 (diff)
fixed order_by and distinct issue on sightings
Diffstat (limited to 'app/jrnl/views.py')
-rw-r--r--app/jrnl/views.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/jrnl/views.py b/app/jrnl/views.py
index 980038c..01167db 100644
--- a/app/jrnl/views.py
+++ b/app/jrnl/views.py
@@ -73,8 +73,8 @@ class EntryDetailView(DetailView):
def get_object(self):
obj = get_object_or_404(
- self.model,
- slug=self.kwargs['slug'],
+ self.model,
+ slug=self.kwargs['slug'],
pub_date__month=self.kwargs['month'],
pub_date__year=self.kwargs['year']
)
@@ -82,9 +82,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).distinct().order_by('ap__apclass__kind')
+ context['wildlife'] = Sighting.objects.filter(location=self.get_object().location).order_by('ap_id', 'ap__apclass__kind').distinct("ap")
return context
+
class EntryDetailViewTXT(EntryDetailView):
template_name = "details/entry.txt"