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})
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 render(request, "todolists/public_list.html", {"todo_lists": todo_lists})
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, 'svn_roots': svn_roots, })
def view(request, list_id): todolist = get_object_or_404(Todolist, id=list_id) svn_roots = Repo.objects.values_list("svn_root", flat=True).order_by().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) arches = set(tp.pkg.arch for tp in todolist.packages) repos = set(tp.pkg.repo for tp in todolist.packages) return render( request, "todolists/view.html", {"list": todolist, "svn_roots": svn_roots, "arches": sorted(arches), "repos": sorted(repos)}, )
def view(request, list_id): todolist = get_object_or_404(Todolist, id=list_id) svn_roots = Repo.objects.values_list('svn_root', flat=True).order_by().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) arches = set(tp.pkg.arch for tp in todolist.packages) repos = set(tp.pkg.repo for tp in todolist.packages) return render( request, 'todolists/view.html', { 'list': todolist, 'svn_roots': svn_roots, 'arches': sorted(arches), 'repos': sorted(repos), })
def view(request, slug): todolist = get_object_or_404(Todolist, slug=slug) svn_roots = Repo.objects.values_list( 'svn_root', flat=True).order_by().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(todolist.packages()) attach_staging(todolist.packages(), todolist.pk) arches = {tp.arch for tp in todolist.packages()} repos = {tp.repo for tp in todolist.packages()} context = { 'list': todolist, 'svn_roots': svn_roots, 'arches': sorted(arches), 'repos': sorted(repos), } return render(request, 'todolists/view.html', context)