summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2008-04-09 19:28:24 -0700
committereliott <eliott@cactuswax.net>2008-04-09 19:28:24 -0700
commit3eea31d8f2d5a4213b00eedaabfc75770aeb418f (patch)
treeb485407102154fd13e2dfdc5e9a9d4da2cbc6026 /packages
parent0930d0cc7403df2bee625f8458d618aab9c767c1 (diff)
Changed to arches and repos in the db.
Added them to the django admin interface as well.
Diffstat (limited to 'packages')
-rw-r--r--packages/views.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/packages/views.py b/packages/views.py
index 867bf0fb..fc19e444 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -8,6 +8,7 @@ from django.contrib.auth.models import User
from datetime import datetime
from archweb_dev.main.utils import validate, render_response
from archweb_dev.main.models import Package, PackageFile, PackageDepend
+from archweb_dev.main.models import Arch, Repo
from django.core.exceptions import ObjectDoesNotExist
@@ -37,7 +38,7 @@ def update(request):
def details(request, pkgid=0, name='', repo=''):
if pkgid == 0:
p = Package.objects.filter(pkgname=name)
- if repo: p = p.filter(repo=Package.REPOS[repo])
+ if repo: p = p.filter(repo__name__iexact=repo)
# if more then one result, send to the search view
if len(p) > 1: return search(request, name)
if len(p) < 1: return render_response(request, 'error_page.html',
@@ -63,8 +64,8 @@ def search(request, query=''):
flagged_only = request.GET.get('flagged_only', 'n')
# build the form lists
- repos = Package.REPOS
- arches = Package.ARCHES
+ repos = Repo.objects.all()
+ arches = Arch.objects.all()
# copy GET data over and add the lists
c = request.GET.copy()
c['repos'], c['arches'] = repos, arches
@@ -89,10 +90,10 @@ def search(request, query=''):
results = res1 | res2
else:
results = Package.objects.all()
- if repo != 'all' and repo in Package.REPOS:
- results = results.filter(repo=Package.REPOS[repo])
- if arch != 'all' and arch in Package.ARCHES:
- results = results.filter(arch=Package.ARCHES[arch])
+ if repo != 'all' and repo in [x.name for x in repos]:
+ results = results.filter(repo__name__iexact=repo)
+ if arch != 'all' and arch in [x.name for x in arches]:
+ results = results.filter(arch__name__iexact=arch)
if maint != 'all':
results = results.filter(maintainer=maint)
if flagged_only != 'n':