summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-03-29 18:37:07 +0200
committerDan McGee <dan@archlinux.org>2012-03-29 18:37:07 +0200
commitef88f3d5ef696b71a65a81f143b13ae27175a1c5 (patch)
tree6e72a4655d2bcf7ea0699807837ce7a9f82f74c7 /public
parent5555ce02278defaef0ef1388c163701eea3aff7e (diff)
downloadarchweb-ef88f3d5ef696b71a65a81f143b13ae27175a1c5.tar.gz
archweb-ef88f3d5ef696b71a65a81f143b13ae27175a1c5.tar.xz
Add developer status table to master keys page
This shows the cross-product of each master key with each developer key so you can see who has been signed, where signatures are missing, etc. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'public')
-rw-r--r--public/views.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/public/views.py b/public/views.py
index 1e1ffc6..a85d738 100644
--- a/public/views.py
+++ b/public/views.py
@@ -1,6 +1,8 @@
+from datetime import datetime
+
from django.conf import settings
from django.contrib.auth.models import User
-from django.db.models import Count
+from django.db.models import Count, Q
from django.http import Http404
from django.views.decorators.cache import cache_control
from django.views.generic import list_detail
@@ -88,17 +90,30 @@ def feeds(request):
@cache_control(max_age=300)
def keys(request):
+ not_expired = Q(expires__gt=datetime.utcnow) | Q(expires__isnull=True)
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(
+
+ sig_counts = PGPSignature.objects.filter(
+ not_expired, valid=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)
+
+ users = User.objects.filter(is_active=True).select_related(
+ 'userprofile__pgp_key').order_by('first_name', 'last_name')
+
+ # frozenset because we are going to do lots of __contains__ lookups
+ signatures = frozenset(PGPSignature.objects.filter(
+ not_expired, valid=True).values_list('signer', 'signee'))
+
context = {
'keys': master_keys,
+ 'active_users': users,
+ 'signatures': signatures,
}
return direct_to_template(request, 'public/keys.html', context)