summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-03-21 21:52:40 +0100
committerDan McGee <dan@archlinux.org>2012-03-21 21:52:40 +0100
commit7d8580b4b151f1357632a26739287b9e4e99fc06 (patch)
treec0cc202e3c2710eb12158dda6b80e83fff6d34ff /public
parent250fa087c990957682d65fb1d1af89a1a176b84f (diff)
downloadarchweb-7d8580b4b151f1357632a26739287b9e4e99fc06.tar.gz
archweb-7d8580b4b151f1357632a26739287b9e4e99fc06.tar.xz
Add number of keys signed to master keys page
This really just makes me look bad, but an interesting fact none the less for people to look at. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'public')
-rw-r--r--public/views.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/public/views.py b/public/views.py
index 1f7006a..1e1ffc6 100644
--- a/public/views.py
+++ b/public/views.py
@@ -1,11 +1,12 @@
from django.conf import settings
from django.contrib.auth.models import User
+from django.db.models import Count
from django.http import Http404
from django.views.decorators.cache import cache_control
from django.views.generic import list_detail
from django.views.generic.simple import direct_to_template
-from devel.models import MasterKey
+from devel.models import MasterKey, PGPSignature
from main.models import Arch, Repo, Donor
from mirrors.models import MirrorUrl
from news.models import News
@@ -87,9 +88,17 @@ def feeds(request):
@cache_control(max_age=300)
def keys(request):
+ master_keys = MasterKey.objects.select_related('owner', 'revoker',
+ 'owner__userprofile', 'revoker__userprofile').filter(
+ revoked__isnull=True)
+ sig_counts = PGPSignature.objects.filter(valid=True,
+ expires__isnull=True).values_list('signer').annotate(
+ Count('signer'))
+ sig_counts = dict((key_id[-16:], ct) for key_id, ct in sig_counts)
+ for key in master_keys:
+ key.signature_count = sig_counts.get(key.pgp_key[-16:], 0)
context = {
- 'keys': MasterKey.objects.select_related('owner', 'revoker',
- 'owner__userprofile', 'revoker__userprofile').all(),
+ 'keys': master_keys,
}
return direct_to_template(request, 'public/keys.html', context)