summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2016-04-26 19:04:17 +0530
committeradityacp2016-04-26 19:04:17 +0530
commiteef2bff4f2b0c66694b2f807849c2d97ba6246a9 (patch)
tree462863dfff51580200b5994927e7e0a155f7eaa8 /yaksh/views.py
parent5d92e6fac7901c9829a759aec539e603dfb66038 (diff)
downloadonline_test-eef2bff4f2b0c66694b2f807849c2d97ba6246a9.tar.gz
online_test-eef2bff4f2b0c66694b2f807849c2d97ba6246a9.tar.bz2
online_test-eef2bff4f2b0c66694b2f807849c2d97ba6246a9.zip
further rebase changes
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 5ff4793..fcfa08c 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -614,7 +614,6 @@ def course_detail(request, course_id):
context_instance=ci)
-
@login_required
def enroll(request, course_id, user_id=None, was_rejected=False):
user = request.user
@@ -658,13 +657,13 @@ 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')
- course = get_object_or_404(Course, Q(creator=user)|Q(teachers=user),
- pk=course_id)
- if course.active:
- course.deactivate()
- else:
- course.activate()
- course.save()
+ 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()
return course_detail(request, course_id)
@@ -1062,7 +1061,7 @@ def search_teacher(request, course_id):
@login_required
def add_teacher(request, course_id):
""" add teachers to the course also add students to
- moderator group if a student is alotted to course """
+ moderator group if a student is allotted to course """
user = request.user
ci = RequestContext(request)