summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-10-12 15:47:26 +0200
committerDan McGee <dan@archlinux.org>2011-10-12 15:47:26 +0200
commit0d693fa1fb788a61359415f56dc487f4aa504a55 (patch)
tree3a5a45f955ea17c835399046b646fd5a77ba195d
parent71e57570c262fffb11ca6e0dc97342119198f740 (diff)
downloadarchweb-0d693fa1fb788a61359415f56dc487f4aa504a55.tar.gz
archweb-0d693fa1fb788a61359415f56dc487f4aa504a55.tar.xz
Add hidden name and desc fields to package search
Not linked from anywhere just yet, but they are available if you know they exist and can be used in the standard query string. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/views.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/packages/views.py b/packages/views.py
index a8216c7..a740e68 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -191,6 +191,8 @@ class LimitTypedChoiceField(forms.TypedChoiceField):
class PackageSearchForm(forms.Form):
repo = forms.MultipleChoiceField(required=False)
arch = forms.MultipleChoiceField(required=False)
+ name = forms.CharField(required=False)
+ desc = forms.CharField(required=False)
q = forms.CharField(required=False)
maintainer = forms.ChoiceField(required=False)
packager = forms.ChoiceField(required=False)
@@ -262,15 +264,24 @@ def search(request, page=None):
elif form.cleaned_data['signed'] == 'Unsigned':
packages = packages.filter(pgp_signature__isnull=True)
- if form.cleaned_data['q']:
- query = form.cleaned_data['q']
- q = Q(pkgname__icontains=query) | Q(pkgdesc__icontains=query)
- packages = packages.filter(q)
if form.cleaned_data['last_update']:
lu = form.cleaned_data['last_update']
packages = packages.filter(last_update__gte=
datetime(lu.year, lu.month, lu.day, 0, 0))
+ if form.cleaned_data['name']:
+ name = form.cleaned_data['name']
+ packages = packages.filter(pkgname__icontains=name)
+
+ if form.cleaned_data['desc']:
+ desc = form.cleaned_data['desc']
+ packages = packages.filter(pkgdesc__icontains=desc)
+
+ if form.cleaned_data['q']:
+ query = form.cleaned_data['q']
+ q = Q(pkgname__icontains=query) | Q(pkgdesc__icontains=query)
+ packages = packages.filter(q)
+
asked_limit = form.cleaned_data['limit']
if asked_limit and asked_limit < 0:
limit = None