diff options
author | adityacp | 2020-04-11 11:00:19 +0530 |
---|---|---|
committer | adityacp | 2020-04-11 11:00:19 +0530 |
commit | 9cc5865251e896a6be54669ddc4c53c70eaef5ac (patch) | |
tree | 06890b97aaeedd014a8a1c10890b1b1daf94b93d /yaksh/views.py | |
parent | 545bfa28925c0f74df8da6cec41de52ca1838175 (diff) | |
download | online_test-9cc5865251e896a6be54669ddc4c53c70eaef5ac.tar.gz online_test-9cc5865251e896a6be54669ddc4c53c70eaef5ac.tar.bz2 online_test-9cc5865251e896a6be54669ddc4c53c70eaef5ac.zip |
Fix tabs and show uploaded questions in questions page
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 33a8680..336fdee 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1509,20 +1509,6 @@ def show_all_questions(request): if not is_moderator(user): raise Http404("You are not allowed to view this page !") - questions = Question.objects.get_queryset().filter( - user_id=user.id, active=True).order_by('-id') - form = QuestionFilterForm(user=user) - user_tags = questions.values_list('tags', flat=True).distinct() - all_tags = Tag.objects.filter(id__in=user_tags) - upload_form = UploadFileForm() - paginator = Paginator(questions, 30) - page = request.GET.get('page') - questions = paginator.get_page(page) - context['objects'] = questions - context['all_tags'] = all_tags - context['form'] = form - context['upload_form'] = upload_form - if request.method == 'POST': if request.POST.get('delete') == 'delete': data = request.POST.getlist('question') @@ -1577,6 +1563,20 @@ def show_all_questions(request): else: message = "Please select atleast one question to test" + questions = Question.objects.get_queryset().filter( + user_id=user.id, active=True).order_by('-id') + form = QuestionFilterForm(user=user) + user_tags = questions.values_list('tags', flat=True).distinct() + all_tags = Tag.objects.filter(id__in=user_tags) + upload_form = UploadFileForm() + paginator = Paginator(questions, 30) + page = request.GET.get('page') + questions = paginator.get_page(page) + context['objects'] = questions + context['all_tags'] = all_tags + context['form'] = form + context['upload_form'] = upload_form + messages.info(request, message) return my_render_to_response(request, 'yaksh/showquestions.html', context) |