summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2008-03-23 05:01:16 +0100
committereliott <eliott@cactuswax.net>2008-03-23 05:01:16 +0100
commitce564d73a6758e6ce8e15f39e47ea67910274a7d (patch)
tree9e507656074df007e5adb8c86bd3c293b26b5241
parentf41fc770e4151f7556011afcb990095f98d5b879 (diff)
downloadarchweb-ce564d73a6758e6ce8e15f39e47ea67910274a7d.tar.gz
archweb-ce564d73a6758e6ce8e15f39e47ea67910274a7d.tar.xz
Added the ability to see flagged packages only, per use or repo
-rw-r--r--devel/views.py25
-rw-r--r--packages/views.py3
-rw-r--r--templates/devel/index.html20
3 files changed, 29 insertions, 19 deletions
diff --git a/devel/views.py b/devel/views.py
index 6684361..f243d7d 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -23,29 +23,36 @@ def index(request):
stats = Package.objects.get_flag_stats()
if thismaint:
# get list of flagged packages for this maintainer
- pkgs = Package.objects.filter(maintainer=thismaint.id).filter(needupdate=True).order_by('repo', 'pkgname')
+ pkgs = Package.objects.filter(
+ maintainer=thismaint.id).filter(
+ needupdate=True).order_by('repo', 'pkgname')
else:
pkgs = None
+
arch_stats = []
- for arch in Arch.objects.all():
+ for arch_name in Package.ARCHES:
+ arch = Package.ARCHES[arch_name]
arch_stats.append({
- 'name': arch.name,
+ 'name': arch_name,
'count': Package.objects.filter(arch__exact = arch).count(),
- 'flagged': Package.objects.filter(arch__exact = arch).filter(needupdate=True).count()
+ 'flagged': Package.objects.filter(
+ arch__exact = arch).filter(needupdate=True).count()
})
repo_stats = []
- for repo in Package.REPOS:
+ for repo_name in Package.REPOS:
+ repo = Package.REPOS[repo_name]
repo_stats.append({
- 'name': repo,
- 'count': Package.objects.filter(repo = Package.REPOS[repo]).count(),
- 'flagged': Package.objects.filter(Package.REPOS[repo]).filter(needupdate=True).count()
+ 'name': repo_name,
+ 'count': Package.objects.filter(repo__exact = repo).count(),
+ 'flagged': Package.objects.filter(
+ repo__exact = repo).filter(needupdate=True).count()
})
return render_response(
request, 'devel/index.html',
{'stats': stats, 'pkgs': pkgs, 'todos': todos, 'maint': thismaint,
- 'repos': repo_stats, 'archs': arch_stats})
+ 'repos': repo_stats, 'arches': arch_stats})
@login_required
#@is_maintainer
diff --git a/packages/views.py b/packages/views.py
index 0b19235..3956671 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -60,6 +60,7 @@ def search(request, query=''):
skip = int(request.GET.get('skip', '0'))
sort = request.GET.get('sort', '')
maint = request.GET.get('maint', 'all')
+ flagged_only = request.GET.get('flagged_only', 'n')
# build the form lists
repos = Package.REPOS
@@ -94,6 +95,8 @@ def search(request, query=''):
results = results.filter(arch=Package.ARCHES[arch])
if maint != 'all':
results = results.filter(maintainer=maint)
+ if flagged_only != 'n':
+ results = results.filter(needupdate=1)
if lastupdate:
results = results.filter(
last_update__gte=datetime(
diff --git a/templates/devel/index.html b/templates/devel/index.html
index 3a09b52..9105537 100644
--- a/templates/devel/index.html
+++ b/templates/devel/index.html
@@ -30,11 +30,11 @@
<th># Packages</th>
<th># Flagged</th>
</tr>
- {% for arch in archs %}
+ {% for arch in arches %}
<tr class="{% cycle pkgr2,pkgr1 %}">
- <td><a href="/packages/?arch={{ arch.name }}">{{ arch.name }}</a></td>
- <td><strong>{{ arch.count }}</strong> packages</td>
- <td><strong>{{ arch.flagged }}</strong> packages</td>
+ <td><strong>{{ arch.name }}</strong></td>
+ <td><a href="/packages/?arch={{ arch.name }}"><strong>{{ arch.count }}</strong> packages</a></td>
+ <td><a href="/packages/?arch={{ arch.name }}&flagged_only=y"><strong>{{ arch.flagged }}</strong> packages</a></td>
</tr>
{% endfor %}
</table>
@@ -50,9 +50,9 @@
</tr>
{% for repo in repos %}
<tr class="{% cycle pkgr2,pkgr1 %}">
- <td><a href="/packages/?repo={{ repo.name }}">{{ repo.name }}</a></td>
- <td><strong>{{ repo.count }}</strong> packages</td>
- <td><strong>{{ repo.flagged }}</strong> packages</td>
+ <td><strong>{{ repo.name }}</strong></td>
+ <td><a href="/packages/?repo={{ repo.name }}"><strong>{{ repo.count }}</strong> packages</a></td>
+ <td><a href="/packages/?repo={{ repo.name }}&flagged_only=y"><strong>{{ repo.flagged }}</strong> packages</a></td>
</tr>
{% endfor %}
</table>
@@ -69,9 +69,9 @@
</tr>
{% for maint in stats %}
<tr class="{% cycle pkgr2,pkgr1 %}">
- <td><a href="/packages/?maint={{ maint.0.id }}">{{ maint.0.get_full_name }}</a></td>
- <td><strong>{{ maint.1 }}</strong> packages</td>
- <td><strong>{{ maint.2 }}</strong> packages</td>
+ <td><strong>{{ maint.0.get_full_name }}</strong></td>
+ <td><a href="/packages/?maint={{ maint.0.id }}"><strong>{{ maint.1 }}</strong> packages</a></td>
+ <td><a href="/packages/?maint={{ maint.0.id }}&flagged_only=y"><strong>{{ maint.2 }}</strong> packages</a></td>
</tr>
{% endfor %}
</table>