add comments explaining prefetch need

This commit is contained in:
David Ormsbee
2012-08-31 15:20:13 -04:00
parent 29be6f8209
commit 04439a3217

View File

@@ -327,6 +327,9 @@ def progress(request, course_id, student_id=None):
# NOTE: To make sure impersonation by instructor works, use
# student instead of request.user in the rest of the function.
# The pre-fetching of groups is done to make auth checks not require an
# additional DB lookup (this kills the Progress page in particular).
student = User.objects.prefetch_related("groups").get(id=student.id)
student_module_cache = StudentModuleCache.cache_for_descriptor_descendents(