summaryrefslogtreecommitdiffstats
path: root/todolists
diff options
context:
space:
mode:
Diffstat (limited to 'todolists')
-rw-r--r--todolists/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/todolists/utils.py b/todolists/utils.py
index 894f3f1..24101e8 100644
--- a/todolists/utils.py
+++ b/todolists/utils.py
@@ -2,9 +2,13 @@ from django.db.models import Count
from main.models import Todolist
+
def get_annotated_todolists():
qs = Todolist.objects.all()
- lists = qs.select_related('creator').annotate(
+ lists = qs.select_related('creator').defer(
+ 'creator__email', 'creator__password', 'creator__is_staff',
+ 'creator__is_active', 'creator__is_superuser',
+ 'creator__last_login', 'creator__date_joined').annotate(
pkg_count=Count('todolistpkg')).order_by('-date_added')
incomplete = qs.filter(todolistpkg__complete=False).annotate(
Count('todolistpkg')).values_list('id', 'todolistpkg__count')