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") )