Loading todo/templates/todo/tasklist_list.html +7 −2 Original line number Diff line number Diff line Loading @@ -3,13 +3,18 @@ {% block content %} <h1>Liste des tâches</h1> <p>{{ task_count }} tâche{{ task_count|pluralize }} dans {{ list_count }} liste{{ list_count|pluralize }}</p> <p>{{ task_count }} tâche{{ task_count|pluralize }} en cours dans {{ list_count }} liste{{ list_count|pluralize }}</p> <ul class="list-group mb-4"> {% for list in lists %} <li class="list-group-item d-flex justify-content-between align-items-center"> <a href="{% url 'todo:show-tasklist' list.slug %}">{{ list.name }}</a> <span class="text-right"> {% if list.own_uncompleted_task_count %} <span class="badge badge-danger badge-pill">{{ list.own_uncompleted_task_count }}</span> {% endif %} <span class="badge badge-primary badge-pill">{{ list.uncompleted_task_set.count }}</span> </span> </li> {% endfor %} </ul> Loading todo/views.py +2 −0 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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(), Loading Loading
todo/templates/todo/tasklist_list.html +7 −2 Original line number Diff line number Diff line Loading @@ -3,13 +3,18 @@ {% block content %} <h1>Liste des tâches</h1> <p>{{ task_count }} tâche{{ task_count|pluralize }} dans {{ list_count }} liste{{ list_count|pluralize }}</p> <p>{{ task_count }} tâche{{ task_count|pluralize }} en cours dans {{ list_count }} liste{{ list_count|pluralize }}</p> <ul class="list-group mb-4"> {% for list in lists %} <li class="list-group-item d-flex justify-content-between align-items-center"> <a href="{% url 'todo:show-tasklist' list.slug %}">{{ list.name }}</a> <span class="text-right"> {% if list.own_uncompleted_task_count %} <span class="badge badge-danger badge-pill">{{ list.own_uncompleted_task_count }}</span> {% endif %} <span class="badge badge-primary badge-pill">{{ list.uncompleted_task_set.count }}</span> </span> </li> {% endfor %} </ul> Loading
todo/views.py +2 −0 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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(), Loading