Hide archived referentes on attribution view
This commit is contained in:
parent
5913c0588f
commit
970148e72b
1 changed files with 2 additions and 2 deletions
|
|
@ -80,11 +80,11 @@ class AttributionView(TemplateView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super(AttributionView, self).get_context_data(**kwargs)
|
||||
# Need 2 queries, because referents with no training item would not appear in the second query
|
||||
referents = Referent.objects.all().order_by('last_name', 'first_name')
|
||||
referents = Referent.objects.filter(archived=False).order_by('last_name', 'first_name')
|
||||
|
||||
# Populate each referent with the number of referencies done during the current school year
|
||||
ref_counts = dict([(ref.id, ref.num_refs)
|
||||
for ref in Referent.objects.filter(training__availability__period__end_date__gte=school_year_start()
|
||||
for ref in Referent.objects.filter(archived=False, training__availability__period__end_date__gte=school_year_start()
|
||||
).annotate(num_refs=Count('training'))])
|
||||
for ref in referents:
|
||||
ref.num_refs = ref_counts.get(ref.id, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue