small fix to todolists

This commit is contained in:
eliott 2008-04-05 13:42:01 -07:00
parent 5f48dda94b
commit 4184dae7c4
2 changed files with 13 additions and 10 deletions

View File

@ -32,7 +32,7 @@
{% endblock %}
{% block content %}
<div class="greybox">
<h3 class="title">ToDo List: {{ list.name }}</h2>
<h2 class="title">ToDo List: {{ list.name }}</h2>
<table id="todotable" class="results" width="100%">
<thead>
<tr>
@ -48,10 +48,10 @@ <h3 class="title">ToDo List: {{ list.name }}</h2>
{% for pkg in pkgs %}
<tr class="{% cycle even,odd %}">
<td><a href="/packages/{{ pkg.pkg.id }}/">{{ pkg.pkg.id }}</a></td>
<td>{{ pkg.pkg.arch.name }}</td>
<td>{{ pkg.pkg.repo.name }}</td>
<td>{{ pkg.pkg.pkgname }}</td>
<td>{{ pkg.pkg.maintainer.get_full_name }}</td>
<td>{{ pkg.pkg.get_arch_display }}</td>
<td>{{ pkg.pkg.get_repo_display }}</td>
<td>{{ pkg.pkg.pkgname }}</td>
<td>{{ pkg.pkg.maintainer.get_full_name|default:"Orphan" }}</td>
<td>
{% if pkg.complete %}
<a href="/todo/flag/{{ list.id }}/{{ pkg.id }}/"><span style="color:blue">Complete</span></a>

View File

@ -10,7 +10,6 @@
IntegrityError = django.db.backend.Database.IntegrityError
@login_required
#@is_maintainer
def flag(request, listid, pkgid):
list = get_object_or_404(Todolist, id=listid)
pkg = get_object_or_404(TodolistPkg, id=pkgid)
@ -22,17 +21,20 @@ def flag(request, listid, pkgid):
def view(request, listid):
list = get_object_or_404(Todolist, id=listid)
pkgs = TodolistPkg.objects.filter(list=list.id).order_by('pkg')
return render_response(request, 'todolists/view.html', {'list':list,'pkgs':pkgs})
return render_response(
request,
'todolists/view.html',
{'list':list,'pkgs':pkgs})
@login_required
def list(request):
lists = Todolist.objects.order_by('-date_added')
for l in lists:
l.complete = TodolistPkg.objects.filter(list=l.id,complete=False).count() == 0
l.complete = TodolistPkg.objects.filter(
list=l.id,complete=False).count() == 0
return render_response(request, 'todolists/list.html', {'lists':lists})
@login_required
#@is_maintainer
@user_passes_test(lambda u: u.has_perm('todolists.add_todolist'))
def add(request):
if request.POST:
@ -49,7 +51,8 @@ def add(request):
todo.save()
# now link in packages
for p in request.POST.get('packages').split("\n"):
for pkg in Package.objects.filter(pkgname=p.strip()).order_by('arch'):
for pkg in Package.objects.filter(
pkgname=p.strip()).order_by('arch'):
todopkg = TodolistPkg(
list = todo,
pkg = pkg)