summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2016-04-26 19:06:16 +0530
committeradityacp2016-04-26 19:06:16 +0530
commit42a2b07a88ece67fe4705ac5a114540fd8366aea (patch)
treee06627945edcc2277ee6f3819a449ed9201a2472 /yaksh/views.py
parenteef2bff4f2b0c66694b2f807849c2d97ba6246a9 (diff)
downloadonline_test-42a2b07a88ece67fe4705ac5a114540fd8366aea.tar.gz
online_test-42a2b07a88ece67fe4705ac5a114540fd8366aea.tar.bz2
online_test-42a2b07a88ece67fe4705ac5a114540fd8366aea.zip
made more rebase changes
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py13
1 files changed, 6 insertions, 7 deletions
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)