diff options
author | adityacp | 2020-09-21 19:12:45 +0530 |
---|---|---|
committer | adityacp | 2020-09-21 19:12:45 +0530 |
commit | f02cd58ea21e08c9a7e8120fd5ced3263cf904f6 (patch) | |
tree | 2d325950d518ed85a4cf7b291055e8b81050939d /yaksh/views.py | |
parent | 45351763f76d75672419b8575f0a1561ee3a8a53 (diff) | |
download | online_test-f02cd58ea21e08c9a7e8120fd5ced3263cf904f6.tar.gz online_test-f02cd58ea21e08c9a7e8120fd5ced3263cf904f6.tar.bz2 online_test-f02cd58ea21e08c9a7e8120fd5ced3263cf904f6.zip |
Add pagination in the lesson statistics
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 2be8734..d909627 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -3906,12 +3906,17 @@ def lesson_statistics(request, course_id, lesson_id, toc_id=None): not course.is_creator(user) or not course.is_creator(user)): raise Http404("You are not allowed to view this page") context = {} + lesson = get_object_or_404(Lesson, id=lesson_id) data = TableOfContents.objects.get_data(course_id, lesson_id) context['data'] = data - context['lesson'] = next(iter(data)).lesson + context['lesson'] = lesson context['course_id'] = course_id if toc_id: per_que_data = TableOfContents.objects.get_question_stats(toc_id) - context['per_que_data'] = per_que_data + paginator = Paginator(per_que_data[1], 50) + context['question'] = per_que_data[0] + page = request.GET.get('page') + per_que_data = paginator.get_page(page) context['is_que_data'] = True + context['objects'] = per_que_data return render(request, 'yaksh/show_lesson_statistics.html', context) |