diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2011-12-05 01:29:30 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2011-12-05 01:29:30 +0000 |
commit | 420a9ea6ab7a912f2288b6f8e852ea2e19556ec9 (patch) | |
tree | b337b7e29cf8303d0b78b5cb165919ffc1a57c4a /todolists | |
parent | 9426870d705cdc8f18b860e00da909e0e812bef7 (diff) | |
parent | 183c4d9cefa95f46c3fa3a6936f837542426eac2 (diff) |
Merge branch 'master' of /srv/git/repositories/parabolaweb
Diffstat (limited to 'todolists')
-rw-r--r-- | todolists/views.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/todolists/views.py b/todolists/views.py index d6a25463..233102cf 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -12,6 +12,7 @@ from django.template import Context, loader from django.utils import simplejson from main.models import Todolist, TodolistPkg, Package +from packages.utils import attach_maintainers from .utils import get_annotated_todolists class TodoListForm(forms.ModelForm): @@ -23,8 +24,8 @@ class TodoListForm(forms.ModelForm): package_names = [s.strip() for s in self.cleaned_data['packages'].split("\n")] package_names = set(package_names) - packages = Package.objects.filter(pkgname__in=package_names).exclude( - repo__testing=True).select_related( + packages = Package.objects.filter(pkgname__in=package_names).filter( + repo__testing=False, repo__staging=False).select_related( 'arch', 'repo').order_by('arch') return packages @@ -49,6 +50,9 @@ def flag(request, listid, pkgid): @never_cache def view(request, listid): todolist = get_object_or_404(Todolist, id=listid) + # 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}) @login_required @@ -157,14 +161,16 @@ def send_todolist_emails(todo_list, new_packages): template = loader.get_template('todolists/email_notification.txt') send_mail('Packages added to todo list \'%s\'' % todo_list.name, template.render(ctx), - 'Parabola <packages@list.parabolagnulinux.org>', + 'Parabola <dev@lists.parabolagnulinux.org>', [maint], fail_silently=True) def public_list(request): todo_lists = Todolist.objects.incomplete() + # total hackjob, but it makes this a lot less query-intensive. + all_pkgs = [tp for tl in todo_lists for tp in tl.packages] + attach_maintainers([tp.pkg for tp in all_pkgs]) return direct_to_template(request, "todolists/public_list.html", {"todo_lists": todo_lists}) - # vim: set ts=4 sw=4 et: |