summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-12-12 17:42:33 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-12-12 17:42:33 -0500
commit8844fd0c6361d3a6ccd88647276e9af0e6cd64d2 (patch)
tree7615c29fe200a3c7be748d3d40ea35628ce9cd39 /public
parentc0d6f0711c4760f08a6beb99818d075d7c993e2e (diff)
parentea87160c397fe1daf63851f0ed0be146bea79196 (diff)
Merge commit 'ea87160' (update)
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 e3d26f92..a8ce2fa7 100644
--- a/public/views.py
+++ b/public/views.py
@@ -1,12 +1,13 @@
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.shortcuts import redirect
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
@@ -70,9 +71,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)