From 9cc5865251e896a6be54669ddc4c53c70eaef5ac Mon Sep 17 00:00:00 2001 From: adityacp Date: Sat, 11 Apr 2020 11:00:19 +0530 Subject: Fix tabs and show uploaded questions in questions page --- yaksh/templates/yaksh/showquestions.html | 142 +++++++++++++++---------------- yaksh/views.py | 28 +++--- 2 files changed, 85 insertions(+), 85 deletions(-) (limited to 'yaksh') diff --git a/yaksh/templates/yaksh/showquestions.html b/yaksh/templates/yaksh/showquestions.html index 6f05a0b..8f1bdaf 100644 --- a/yaksh/templates/yaksh/showquestions.html +++ b/yaksh/templates/yaksh/showquestions.html @@ -146,78 +146,78 @@ - -
- {% csrf_token %} -
+ + {% csrf_token %} +
+
+ +  Add Question + {% if objects %} +
+
+ {% include "yaksh/paginator.html" %} +
+
Select All
+
+ + + + + + + + + + + + + + + + {% for question in objects %} + + + + + + + + + + + + {% endfor %} + +
Select Sr No. Summary  Language  Type  Marks  TestDownloadDelete
+ + {{forloop.counter}}{{question.summary|capfirst}}{{question.language|capfirst}}{{question.type|capfirst}}{{question.points}} + + Test + + +  Download +  Delete
+
+
+ {% include "yaksh/paginator.html" %} + {% else %} +

+
+

No Questions found

+
+ {% endif %} +

- -  Add Question - {% if objects %} -
-
- {% include "yaksh/paginator.html" %} -
-
Select All
-
- - - - - - - - - - - - - - - - {% for question in objects %} - - - - - - - - - - - - {% endfor %} - -
Select Sr No. Summary  Language  Type  Marks  TestDownloadDelete
- - {{forloop.counter}}{{question.summary|capfirst}}{{question.language|capfirst}}{{question.type|capfirst}}{{question.points}} - - Test - - -  Download -  Delete
-
-
- {% include "yaksh/paginator.html" %} - {% else %} -

-
-

No Questions found

-
- {% endif %} -
-
-
- {% if objects %} - - - - {% endif %} -
-
+
+ {% if objects %} + + + + {% endif %} +
+ + {% endblock %} 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) -- cgit