summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2020-04-11 11:00:19 +0530
committeradityacp2020-04-11 11:00:19 +0530
commit9cc5865251e896a6be54669ddc4c53c70eaef5ac (patch)
tree06890b97aaeedd014a8a1c10890b1b1daf94b93d
parent545bfa28925c0f74df8da6cec41de52ca1838175 (diff)
downloadonline_test-9cc5865251e896a6be54669ddc4c53c70eaef5ac.tar.gz
online_test-9cc5865251e896a6be54669ddc4c53c70eaef5ac.tar.bz2
online_test-9cc5865251e896a6be54669ddc4c53c70eaef5ac.zip
Fix tabs and show uploaded questions in questions page
-rw-r--r--yaksh/templates/yaksh/showquestions.html142
-rw-r--r--yaksh/views.py28
2 files changed, 85 insertions, 85 deletions
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 @@
<!-- End Card body -->
</div>
<!-- End card filters and search -->
- </div>
- <form name=frm action="{% url 'yaksh:show_questions' %}" method="post">
- {% csrf_token %}
- <div id="filtered-questions">
+ <form name=frm action="{% url 'yaksh:show_questions' %}" method="post">
+ {% csrf_token %}
+ <div id="filtered-questions">
+ <br>
+ <a class="btn btn-lg btn-success" href="{% url 'yaksh:add_question' %}">
+ <i class="fa fa-plus-circle"></i>&nbsp;Add Question</a>
+ {% if objects %}
+ <div>
+ <br>
+ {% include "yaksh/paginator.html" %}
+ <br>
+ <h5><input id="checkall" type="checkbox"> Select All </h5>
+ <div class="table-wrapper-2">
+ <table id="questions-table" class="tablesorter table table-striped table-responsive-sm">
+ <thead>
+ <tr>
+ <th> Select </th>
+ <th> Sr No. </th>
+ <th> Summary&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Language&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Type&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Marks&nbsp;<i class="fa fa-sort"></i> </th>
+ <th>Test</th>
+ <th>Download</th>
+ <th>Delete</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for question in objects %}
+ <tr>
+ <td>
+ <input type="checkbox" name="question" value="{{ question.id }}">
+ </td>
+ <td>{{forloop.counter}}</td>
+ <td><a href="{% url 'yaksh:add_question' question.id %}">{{question.summary|capfirst}}</a></td>
+ <td>{{question.language|capfirst}}</td>
+ <td>{{question.type|capfirst}}</td>
+ <td>{{question.points}}</td>
+ <td>
+ <a href="{% url 'yaksh:test_question' question.id %}" class="btn btn-info">
+ Test
+ </a>
+ </td>
+ <td><a href="{% url 'yaksh:download_question' question.id %}" class="btn btn-primary">
+ <i class="fa fa-download"></i>&nbsp;Download</a></td>
+ <td><a href="{% url 'yaksh:delete_question' question.id %}" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete {{question.summary|capfirst}}?')">
+ <i class="fa fa-trash"></i>&nbsp;Delete</a></td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+ </div>
+ {% include "yaksh/paginator.html" %}
+ {% else %}
+ <br><br>
+ <div class="alert alert-info">
+ <center><h3>No Questions found</h3></center>
+ </div>
+ {% endif %}
+ </div>
<br>
- <a class="btn btn-lg btn-success" href="{% url 'yaksh:add_question' %}">
- <i class="fa fa-plus-circle"></i>&nbsp;Add Question</a>
- {% if objects %}
- <div>
- <br>
- {% include "yaksh/paginator.html" %}
- <br>
- <h5><input id="checkall" type="checkbox"> Select All </h5>
- <div class="table-wrapper-2">
- <table id="questions-table" class="tablesorter table table-striped table-responsive-sm">
- <thead>
- <tr>
- <th> Select </th>
- <th> Sr No. </th>
- <th> Summary&nbsp;<i class="fa fa-sort"></i> </th>
- <th> Language&nbsp;<i class="fa fa-sort"></i> </th>
- <th> Type&nbsp;<i class="fa fa-sort"></i> </th>
- <th> Marks&nbsp;<i class="fa fa-sort"></i> </th>
- <th>Test</th>
- <th>Download</th>
- <th>Delete</th>
- </tr>
- </thead>
- <tbody>
- {% for question in objects %}
- <tr>
- <td>
- <input type="checkbox" name="question" value="{{ question.id }}">
- </td>
- <td>{{forloop.counter}}</td>
- <td><a href="{% url 'yaksh:add_question' question.id %}">{{question.summary|capfirst}}</a></td>
- <td>{{question.language|capfirst}}</td>
- <td>{{question.type|capfirst}}</td>
- <td>{{question.points}}</td>
- <td>
- <a href="{% url 'yaksh:test_question' question.id %}" class="btn btn-info">
- Test
- </a>
- </td>
- <td><a href="{% url 'yaksh:download_question' question.id %}" class="btn btn-primary">
- <i class="fa fa-download"></i>&nbsp;Download</a></td>
- <td><a href="{% url 'yaksh:delete_question' question.id %}" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete {{question.summary|capfirst}}?')">
- <i class="fa fa-trash"></i>&nbsp;Delete</a></td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
- </div>
- {% include "yaksh/paginator.html" %}
- {% else %}
- <br><br>
- <div class="alert alert-info">
- <center><h3>No Questions found</h3></center>
- </div>
- {% endif %}
- </div>
- <br>
- <center>
- {% if objects %}
- <button class="btn btn-lg btn-primary" type="submit" name='download' value='download'><i class="fa fa-download"></i>&nbsp;Download Selected</button>
- <button class="btn btn-lg btn-primary" type="submit" name="test" value="test">Test Selected</button>
- <button class="btn btn-lg btn-danger" type="submit" onClick="return confirm_delete(frm);" name='delete' value='delete'>
- <i class="fa fa-trash"></i>&nbsp;Delete Selected</button>
- {% endif %}
- </center>
- </form>
+ <center>
+ {% if objects %}
+ <button class="btn btn-lg btn-primary" type="submit" name='download' value='download'><i class="fa fa-download"></i>&nbsp;Download Selected</button>
+ <button class="btn btn-lg btn-primary" type="submit" name="test" value="test">Test Selected</button>
+ <button class="btn btn-lg btn-danger" type="submit" onClick="return confirm_delete(frm);" name='delete' value='delete'>
+ <i class="fa fa-trash"></i>&nbsp;Delete Selected</button>
+ {% endif %}
+ </center>
+ </form>
+ </div>
</div>
</div>
{% 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)