diff options
author | CruiseDevice | 2021-06-14 15:44:59 +0530 |
---|---|---|
committer | CruiseDevice | 2021-06-14 15:44:59 +0530 |
commit | d81699719c35a24fc2c7917b8d147e332929ce31 (patch) | |
tree | 8677df2eb3aa72624bfa2a978797205651171752 | |
parent | 67d7e943cf3f724c5169de6f867f43b9352c5c90 (diff) | |
download | online_test-d81699719c35a24fc2c7917b8d147e332929ce31.tar.gz online_test-d81699719c35a24fc2c7917b8d147e332929ce31.tar.bz2 online_test-d81699719c35a24fc2c7917b8d147e332929ce31.zip |
prefetch students, requests, rejected
-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') |