summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2016-04-26 19:06:16 +0530
committeradityacp2016-04-26 19:06:16 +0530
commit42a2b07a88ece67fe4705ac5a114540fd8366aea (patch)
treee06627945edcc2277ee6f3819a449ed9201a2472 /yaksh
parenteef2bff4f2b0c66694b2f807849c2d97ba6246a9 (diff)
downloadonline_test-42a2b07a88ece67fe4705ac5a114540fd8366aea.tar.gz
online_test-42a2b07a88ece67fe4705ac5a114540fd8366aea.tar.bz2
online_test-42a2b07a88ece67fe4705ac5a114540fd8366aea.zip
made more rebase changes
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/templates/yaksh/course_detail.html4
-rw-r--r--yaksh/views.py13
2 files changed, 7 insertions, 10 deletions
diff --git a/yaksh/templates/yaksh/course_detail.html b/yaksh/templates/yaksh/course_detail.html
index ccb3a10..7169667 100644
--- a/yaksh/templates/yaksh/course_detail.html
+++ b/yaksh/templates/yaksh/course_detail.html
@@ -2,7 +2,7 @@
{% block title %} Course {% endblock title %}
-{% block subtitle %} {% for course in courses %}{{ course.name }}{% endfor %} {% endblock %}
+{% block subtitle %} {{ course.name }} {% endblock %}
{% block css %}
<link rel="stylesheet" media="all" type="text/css" href="{{ URL_ROOT }}/static/yaksh/css/course.css" />
@@ -11,7 +11,6 @@
<script language="JavaScript" type="text/javascript" src="{{ URL_ROOT }}/static/yaksh/js/course.js"></script>
{% endblock %}
{% block manage %}
-{% for course in courses %}
<div class="row">
<div class="span6 wrap">
<center><b><u>Requests</u></b></center><br>
@@ -89,5 +88,4 @@
<div class="pull-right">
<a class="btn primary" href="{{URL_ROOT}}/exam/manage/toggle_status/{{ course.id }}/">{% if course.active %}Deactivate Course {% else %} Activate Course {% endif %}</a>
</div>
-{% endfor %}
{% endblock %}
diff --git a/yaksh/views.py b/yaksh/views.py
index fcfa08c..245713f 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -657,13 +657,12 @@ def toggle_course_status(request, course_id):
user = request.user
if not is_moderator(user):
raise Http404('You are not allowed to view this page')
- courses = Course.objects.filter(Q(creator=user)|Q(teachers=user), id=course_id).distinct()
- for course in courses:
- if course.active:
- course.deactivate()
- else:
- course.activate()
- course.save()
+ course = Course.objects.filter(Q(creator=user)|Q(teachers=user), pk=course_id)[0]
+ if course.active:
+ course.deactivate()
+ else:
+ course.activate()
+ course.save()
return course_detail(request, course_id)