|
@@ -7,6 +7,7 @@ from django.http import HttpResponse
|
|
|
from django.views.decorators.csrf import csrf_exempt
|
|
|
from django.views.decorators.http import require_POST
|
|
|
from django.utils import timezone
|
|
|
+from django.db.models import Count, Q
|
|
|
|
|
|
from .models import TaskList, Task
|
|
|
from .forms import TaskForm, CommentForm
|
|
@@ -19,6 +20,7 @@ def tasklist_list(request):
|
|
|
if not request.user.is_superuser:
|
|
|
lists = lists.filter(group__in=request.user.groups.all())
|
|
|
lists = lists.order_by('name')
|
|
|
+ lists = lists.annotate(own_uncompleted_task_count=Count('task', filter=Q(task__completed_date__isnull=True, task__assigned_to=request.user)))
|
|
|
return render(request, 'todo/tasklist_list.html', {
|
|
|
'lists': lists,
|
|
|
'task_count': Task.objects.filter(completed_date__isnull=True, task_list__in=lists).count(),
|