From dca00e7aabc057d0069606fec6261cc571ddcb71 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 2 Dec 2014 14:53:38 -0600 Subject: Filter maintainer list on packages page by allowed repos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We do this elsewhere on the master keys page, so do the same thing here. Noticed-by: Johannes Löthberg Signed-off-by: Dan McGee --- packages/views/search.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'packages') diff --git a/packages/views/search.py b/packages/views/search.py index 0b776d79..e4cd0423 100644 --- a/packages/views/search.py +++ b/packages/views/search.py @@ -6,6 +6,7 @@ from django.http import HttpResponse from django.views.generic import ListView +from devel.models import UserProfile from main.models import Package, Arch, Repo from main.utils import empty_response, make_choice from ..models import PackageRelation @@ -36,14 +37,16 @@ def __init__(self, *args, **kwargs): self.fields['arch'].choices = make_choice( [arch.name for arch in Arch.objects.all()]) self.fields['q'].widget.attrs.update({"size": "30"}) - maints = User.objects.filter(is_active=True).order_by( + + profile_ids = UserProfile.allowed_repos.through.objects.values('userprofile_id') + people = User.objects.filter( + is_active=True, userprofile__id__in=profile_ids).order_by( 'first_name', 'last_name') - self.fields['maintainer'].choices = \ - [('', 'All'), ('orphan', 'Orphan')] + \ - [(m.username, m.get_full_name()) for m in maints] - self.fields['packager'].choices = \ - [('', 'All'), ('unknown', 'Unknown')] + \ - [(m.username, m.get_full_name()) for m in maints] + people = [('', 'All'), ('orphan', 'Orphan')] + \ + [(p.username, p.get_full_name()) for p in people] + + self.fields['maintainer'].choices = people + self.fields['packager'].choices = people def exact_matches(self): # only do exact match search if 'q' is sole parameter -- cgit v1.2.3-54-g00ecf