diff options
-rw-r--r-- | yaksh/views.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 5761f37..3727514 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1185,7 +1185,9 @@ def course_detail(request, course_id): if not is_moderator(user): raise Http404('You are not allowed to view this page') - course = get_object_or_404(Course, pk=course_id) + course = Course.objects.prefetch_related( + 'students', 'requests', 'rejected' + ).get(id=course_id) if not course.is_creator(user) and not course.is_teacher(user): raise Http404('This course does not belong to you') |