1
0
Fork 0

Exclude observers with no observations

merge-requests/491/head
Pierros Papadeas 2018-05-13 19:02:38 -07:00
parent f92024db37
commit 883978e74a
No known key found for this signature in database
GPG Key ID: AB1301B4FCDFF5D4
1 changed files with 3 additions and 1 deletions

View File

@ -178,7 +178,9 @@ class ObservationListView(ListView):
"""
context = super(ObservationListView, self).get_context_data(**kwargs)
context['satellites'] = Satellite.objects.all()
context['authors'] = User.objects.all().order_by('first_name', 'last_name', 'username')
context['authors'] = User.objects.annotate(obs_count=Count('observations')) \
.filter(obs_count__gt=0) \
.order_by('first_name', 'last_name', 'username')
context['stations'] = Station.objects.all().order_by('id')
norad_cat_id = self.request.GET.get('norad', None)
observer = self.request.GET.get('observer', None)