From 68735e475981e985fcbdad7fe056d5f58c71912a Mon Sep 17 00:00:00 2001 From: SKairinos Date: Tue, 20 Feb 2024 12:59:05 +0000 Subject: [PATCH] fix: prefetch student and teacher profile --- codeforlife/user/models/user.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codeforlife/user/models/user.py b/codeforlife/user/models/user.py index 7784553..7372215 100644 --- a/codeforlife/user/models/user.py +++ b/codeforlife/user/models/user.py @@ -109,6 +109,7 @@ def get_queryset(self): super() .get_queryset() .filter(new_teacher__isnull=False, new_student__isnull=True) + .prefetch_related("new_teacher") ) @@ -261,6 +262,7 @@ def get_queryset(self): # TODO: remove in new model new_student__class_field__isnull=False, ) + .prefetch_related("new_student") )