diff options
author | Dan McGee <dan@archlinux.org> | 2011-02-23 12:09:29 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-02-23 12:15:45 -0600 |
commit | 3181e970ce9dcc4fd996499ee536e4c2454e89dd (patch) | |
tree | 5466564b96c46c81d21140567170a4d6433f6e07 /packages/views.py | |
parent | f6c41b273c8962718b303c6050c2fd8bcea533a8 (diff) |
Add stale package relations status screen
For now it is read only. Display a few tables of various ways of
detecting stale package relations. These include inactive users, pkgbase
values that no longer exist, and users that are listed as maintainers
that don't have the proper permissions for that package anymore.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/views.py')
-rw-r--r-- | packages/views.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/packages/views.py b/packages/views.py index e792175b..9a2094aa 100644 --- a/packages/views.py +++ b/packages/views.py @@ -2,7 +2,7 @@ from django import forms from django.contrib import messages from django.contrib.admin.widgets import AdminDateWidget from django.contrib.auth.models import User -from django.contrib.auth.decorators import permission_required +from django.contrib.auth.decorators import login_required, permission_required from django.conf import settings from django.core.mail import send_mail from django.db.models import Q @@ -23,7 +23,7 @@ from main.models import Arch, Repo, Signoff from main.utils import make_choice from mirrors.models import MirrorUrl from .models import PackageRelation -from .utils import get_group_info, get_differences_info +from .utils import get_group_info, get_differences_info, get_wrong_permissions def opensearch(request): if request.is_secure(): @@ -401,4 +401,21 @@ def arch_differences(request): } return direct_to_template(request, 'packages/differences.html', context) +@login_required +def stale_relations(request): + relations = PackageRelation.objects.select_related('user') + pkgbases = Package.objects.all().values('pkgbase') + + inactive_user = relations.filter(user__is_active=False) + missing_pkgbase = relations.exclude( + pkgbase__in=pkgbases).order_by('pkgbase') + wrong_permissions = get_wrong_permissions() + + context = { + 'inactive_user': inactive_user, + 'missing_pkgbase': missing_pkgbase, + 'wrong_permissions': wrong_permissions, + } + return direct_to_template(request, 'packages/stale_relations.html', context) + # vim: set ts=4 sw=4 et: |