summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-01-04 12:15:29 -0600
committerDan McGee <dan@archlinux.org>2012-01-04 12:15:29 -0600
commit7b7dcfaa7c1b10d4f595a68e4136f30162930011 (patch)
tree59c063270c10d1edbdfd4c849b3b275e028d9b35
parent9ddbe26e4c397c9a0b9fda73a0ce79bc658464d9 (diff)
Add new todolist pkgbase list view
This is for use after rebuilds when moving packages out of the staging and testing repositories. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--templates/todolists/view.html5
-rw-r--r--todolists/urls.py3
-rw-r--r--todolists/views.py31
3 files changed, 30 insertions, 9 deletions
diff --git a/templates/todolists/view.html b/templates/todolists/view.html
index 6516f73e..d45905e3 100644
--- a/templates/todolists/view.html
+++ b/templates/todolists/view.html
@@ -23,6 +23,11 @@
<div>{{list.description|urlize|linebreaks}}</div>
+ <p>Link to lists of pkgbase values:</p>
+ <ul>{% for svn_root in svn_roots %}
+ <li><a href="pkgbases/{{ svn_root }}/">{{ svn_root }}</a></li>
+ {% endfor %}</ul>
+
<table id="dev-todo-pkglist" class="results todo-table">
<thead>
<tr>
diff --git a/todolists/urls.py b/todolists/urls.py
index 2612a52e..0bd8817b 100644
--- a/todolists/urls.py
+++ b/todolists/urls.py
@@ -5,7 +5,8 @@ from .views import DeleteTodolist
urlpatterns = patterns('todolists.views',
(r'^$', 'todolist_list'),
- (r'^(\d+)/$', 'view'),
+ (r'^(?P<list_id>\d+)/$', 'view'),
+ (r'^(?P<list_id>\d+)/pkgbases/(?P<svn_root>[a-z]+)/$', 'list_pkgbases'),
(r'^add/$', 'add'),
(r'^edit/(?P<list_id>\d+)/$', 'edit'),
(r'^flag/(\d+)/(\d+)/$', 'flag'),
diff --git a/todolists/views.py b/todolists/views.py
index 585cefd0..d413ca47 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -2,7 +2,7 @@ from django import forms
from django.http import HttpResponse
from django.core.mail import send_mail
-from django.shortcuts import get_object_or_404, redirect
+from django.shortcuts import get_list_or_404, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required, permission_required
from django.db import transaction
from django.views.decorators.cache import never_cache
@@ -11,7 +11,7 @@ from django.views.generic.simple import direct_to_template
from django.template import Context, loader
from django.utils import simplejson
-from main.models import Todolist, TodolistPkg, Package
+from main.models import Todolist, TodolistPkg, Package, Repo
from packages.utils import attach_maintainers
from .utils import get_annotated_todolists
@@ -35,9 +35,9 @@ class TodoListForm(forms.ModelForm):
@permission_required('main.change_todolistpkg')
@never_cache
-def flag(request, listid, pkgid):
- todolist = get_object_or_404(Todolist, id=listid)
- pkg = get_object_or_404(TodolistPkg, id=pkgid)
+def flag(request, list_id, pkg_id):
+ todolist = get_object_or_404(Todolist, id=list_id)
+ pkg = get_object_or_404(TodolistPkg, id=pkg_id)
pkg.complete = not pkg.complete
pkg.save()
if request.is_ajax():
@@ -48,12 +48,27 @@ def flag(request, listid, pkgid):
@login_required
@never_cache
-def view(request, listid):
- todolist = get_object_or_404(Todolist, id=listid)
+def view(request, list_id):
+ todolist = get_object_or_404(Todolist, id=list_id)
+ svn_roots = Repo.objects.order_by().values_list(
+ 'svn_root', flat=True).distinct()
# we don't hold onto the result, but the objects are the same here,
# so accessing maintainers in the template is now cheap
attach_maintainers(tp.pkg for tp in todolist.packages)
- return direct_to_template(request, 'todolists/view.html', {'list': todolist})
+ return direct_to_template(request, 'todolists/view.html', {
+ 'list': todolist,
+ 'svn_roots': svn_roots,
+ })
+
+# really no need for login_required on this one...
+def list_pkgbases(request, list_id, svn_root):
+ '''Used to make bulk moves of packages a lot easier.'''
+ todolist = get_object_or_404(Todolist, id=list_id)
+ repos = get_list_or_404(Repo, svn_root=svn_root)
+ pkgbases = set(tp.pkg.pkgbase for tp in todolist.packages
+ if tp.pkg.repo in repos)
+ return HttpResponse('\n'.join(sorted(pkgbases)),
+ mimetype='text/plain')
@login_required
@never_cache