diff options
author | Dan McGee <dan@archlinux.org> | 2011-03-03 19:31:58 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-03-03 19:33:48 +0100 |
commit | 3a85ead4475b8acfa236a5b1825b844d0431bbaf (patch) | |
tree | 714f79506a46b935f0f71f76c19693160f6535ec | |
parent | 95a71576d2381b87916645b169fbc39898c250b3 (diff) | |
download | archweb-3a85ead4475b8acfa236a5b1825b844d0431bbaf.tar.gz archweb-3a85ead4475b8acfa236a5b1825b844d0431bbaf.tar.xz |
Make Arch and Repo a MultipleChoice on package search
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | packages/views.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/views.py b/packages/views.py index 1ab0425..7c57d88 100644 --- a/packages/views.py +++ b/packages/views.py @@ -127,8 +127,8 @@ def getmaintainer(request, name, repo, arch): return HttpResponse(str('\n'.join(names)), mimetype='text/plain') class PackageSearchForm(forms.Form): - repo = forms.ChoiceField(required=False) - arch = forms.ChoiceField(required=False) + repo = forms.MultipleChoiceField(required=False) + arch = forms.MultipleChoiceField(required=False) q = forms.CharField(required=False) maintainer = forms.ChoiceField(required=False) last_update = forms.DateField(required=False, widget=AdminDateWidget(), @@ -157,9 +157,9 @@ class PackageSearchForm(forms.Form): def __init__(self, *args, **kwargs): super(PackageSearchForm, self).__init__(*args, **kwargs) - self.fields['repo'].choices = [('', 'All')] + make_choice( + self.fields['repo'].choices = make_choice( [repo.name for repo in Repo.objects.all()]) - self.fields['arch'].choices = [('', 'All')] + make_choice( + 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('username') @@ -178,11 +178,11 @@ def search(request, page=None): if form.is_valid(): if form.cleaned_data['repo']: packages = packages.filter( - repo__name=form.cleaned_data['repo']) + repo__name__in=form.cleaned_data['repo']) if form.cleaned_data['arch']: packages = packages.filter( - arch__name=form.cleaned_data['arch']) + arch__name__in=form.cleaned_data['arch']) if form.cleaned_data['maintainer'] == 'orphan': inner_q = PackageRelation.objects.all().values('pkgbase') |