diff options
-rw-r--r-- | devel/views.py | 15 | ||||
-rw-r--r-- | templates/devel/index.html | 8 |
2 files changed, 14 insertions, 9 deletions
diff --git a/devel/views.py b/devel/views.py index 39f28a6..cf0d8ad 100644 --- a/devel/views.py +++ b/devel/views.py @@ -13,7 +13,7 @@ from django.contrib.auth.models import User, Group from django.contrib.sites.models import Site from django.core.mail import send_mail from django.db import transaction -from django.db.models import F +from django.db.models import F, Count from django.http import Http404 from django.shortcuts import get_object_or_404 from django.template import loader, Context @@ -54,6 +54,11 @@ def index(request): signoffs = sorted(get_signoff_groups(user=request.user), key=operator.attrgetter('pkgbase')) + arches = Arch.objects.all().annotate( + total_ct=Count('packages'), flagged_ct=Count('packages__flag_date')) + repos = Repo.objects.all().annotate( + total_ct=Count('packages'), flagged_ct=Count('packages__flag_date')) + maintainers = get_annotated_maintainers() maintained = PackageRelation.objects.filter( @@ -70,12 +75,12 @@ def index(request): page_dict = { 'todos': todolists, - 'repos': Repo.objects.all(), - 'arches': Arch.objects.all(), + 'arches': arches, + 'repos': repos, 'maintainers': maintainers, 'orphan': orphan, - 'flagged' : flagged, - 'todopkgs' : todopkgs, + 'flagged': flagged, + 'todopkgs': todopkgs, 'signoffs': signoffs } diff --git a/templates/devel/index.html b/templates/devel/index.html index a0ccb91..c67cf27 100644 --- a/templates/devel/index.html +++ b/templates/devel/index.html @@ -194,10 +194,10 @@ <td>{{ arch.name }}</td> <td><a href="/packages/?arch={{ arch.name }}" title="View all packages for the {{ arch.name }} architecture"> - <strong>{{ arch.packages.count }}</strong> packages</a></td> + <strong>{{ arch.total_ct }}</strong> packages</a></td> <td><a href="/packages/?arch={{ arch.name }}&flagged=Flagged" title="View all flagged packages for the {{ arch.name }} architecture"> - <strong>{{ arch.packages.flagged.count }}</strong> packages</a></td> + <strong>{{ arch.flagged_ct }}</strong> packages</a></td> </tr> {% endfor %} </tbody> @@ -224,10 +224,10 @@ <td>{{ repo.name }}</td> <td><a href="/packages/?repo={{ repo.name }}" title="View all packages in the {{ repo.name }} repository"> - <strong>{{ repo.packages.count }}</strong> packages</a></td> + <strong>{{ repo.total_ct }}</strong> packages</a></td> <td><a href="/packages/?repo={{ repo.name }}&flagged=Flagged" title="View all flagged packages in the {{ repo.name }} repository"> - <strong>{{ repo.packages.flagged.count }}</strong> packages</a></td> + <strong>{{ repo.flagged_ct }}</strong> packages</a></td> </tr> {% endfor %} </tbody> |