diff options
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 17 |
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) |