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