diff options
author | eliott <eliott@cactuswax.net> | 2008-03-23 03:51:01 +0100 |
---|---|---|
committer | eliott <eliott@cactuswax.net> | 2008-03-23 03:51:01 +0100 |
commit | 7640082d14af2827ab22caa6dce3575f5112d7cf (patch) | |
tree | 6fb40e5c0dc734f5646166708b1e39ab5c30859d /devel | |
parent | 37361f664f5092d5f4cc7bb2a20e1e86cbbf558d (diff) | |
download | archweb-7640082d14af2827ab22caa6dce3575f5112d7cf.tar.gz archweb-7640082d14af2827ab22caa6dce3575f5112d7cf.tar.xz |
Refactored the model to remove arch and repo tables.
Refactored the model to remove the arch and repo tables. Those data points
are now encapsulated in the package table as an ENUM field.
Changes to models and templates as needed.
Diffstat (limited to 'devel')
-rw-r--r-- | devel/views.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/devel/views.py b/devel/views.py index 978837b..6684361 100644 --- a/devel/views.py +++ b/devel/views.py @@ -3,8 +3,8 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.core import validators from archweb_dev.main.utils import render_response, validate -from archweb_dev.main.models import Package, Repo, Todolist, TodolistPkg -from archweb_dev.main.models import UserProfile, News, Donor, Mirror, Arch +from archweb_dev.main.models import Package, Todolist, TodolistPkg +from archweb_dev.main.models import UserProfile, News, Donor, Mirror from django.http import HttpResponse from django.template import Context, loader @@ -35,11 +35,11 @@ def index(request): }) repo_stats = [] - for repo in Repo.objects.all(): + for repo in Package.REPOS: repo_stats.append({ - 'name': repo.name, - 'count': Package.objects.filter(repo__exact = repo).count(), - 'flagged': Package.objects.filter(repo__exact = repo).filter(needupdate=True).count() + 'name': repo, + 'count': Package.objects.filter(repo = Package.REPOS[repo]).count(), + 'flagged': Package.objects.filter(Package.REPOS[repo]).filter(needupdate=True).count() }) return render_response( @@ -89,8 +89,8 @@ def guide(request): def siteindex(request): # get the most recent 10 news items news = News.objects.order_by('-postdate', '-id')[:10] - pkgs = Package.objects.exclude(repo__name__exact='Testing').order_by('-last_update')[:15] - repos = Repo.objects.order_by('name') + pkgs = Package.objects.exclude(repo = Package.REPOS.testing).order_by('-last_update')[:15] + repos = Package.REPOS return render_response( request, 'devel/siteindex.html', {'news_updates': news, 'pkg_updates': pkgs, 'repos': repos}) |