From cb02df1681c61d5b58b319b77a8d4bf3f3593697 Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Sun, 4 Nov 2018 01:33:34 +0000 Subject: [PATCH] Show counts on the active groups page and on the active wgs page. Fixes #2060. Commit ready for merge. - Legacy-Id: 15709 --- ietf/group/views.py | 4 ++-- ietf/templates/group/active_groups.html | 6 ++++-- ietf/templates/group/active_wgs.html | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ietf/group/views.py b/ietf/group/views.py index 082b0e0a2..89b1fd921 100644 --- a/ietf/group/views.py +++ b/ietf/group/views.py @@ -45,7 +45,7 @@ from django import forms from django.conf import settings from django.contrib.auth.decorators import login_required from django.db.models.aggregates import Max -from django.db.models import Q +from django.db.models import Q, Count from django.http import HttpResponse, HttpResponseForbidden, Http404, HttpResponseRedirect, JsonResponse from django.shortcuts import render, redirect, get_object_or_404 from django.template.loader import render_to_string @@ -301,7 +301,7 @@ def active_groups(request, group_type=None): raise Http404 def active_group_types(request): - grouptypes = GroupTypeName.objects.filter(slug__in=['wg','rg','ag','team','dir','review','area','program']) + grouptypes = GroupTypeName.objects.filter(slug__in=['wg','rg','ag','team','dir','review','area','program']).filter(group__state='active').annotate(group_count=Count('group')) return render(request, 'group/active_groups.html', {'grouptypes':grouptypes}) def active_dirs(request): diff --git a/ietf/templates/group/active_groups.html b/ietf/templates/group/active_groups.html index 41f8ff6b4..6eab00f9f 100644 --- a/ietf/templates/group/active_groups.html +++ b/ietf/templates/group/active_groups.html @@ -14,14 +14,16 @@ - - + + + {% for typename in grouptypes %} + {% endfor %} diff --git a/ietf/templates/group/active_wgs.html b/ietf/templates/group/active_wgs.html index 76a5aa3c0..fe7061899 100644 --- a/ietf/templates/group/active_wgs.html +++ b/ietf/templates/group/active_wgs.html @@ -47,7 +47,7 @@ {% endif %} {% if area.groups %} -

{{ area.acronym }} active WG{{ area.groups|pluralize}}

+

{{ area.acronym }} active WG{{ area.groups|pluralize}} ({{area.groups.count}})

TypeDescriptionTypeCountDescription
{{ typename.name }}{{ typename.group_count }} {{ typename.desc }}