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