summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/templates/yaksh/addteacher.html2
-rw-r--r--yaksh/templates/yaksh/course_detail.html2
-rw-r--r--yaksh/views.py17
3 files changed, 10 insertions, 11 deletions
diff --git a/yaksh/templates/yaksh/addteacher.html b/yaksh/templates/yaksh/addteacher.html
index 0ebbbbd..39535bc 100644
--- a/yaksh/templates/yaksh/addteacher.html
+++ b/yaksh/templates/yaksh/addteacher.html
@@ -21,7 +21,7 @@
<form action="{{ URL_ROOT }}/exam/manage/addteacher/{{ course.id }}/" method="post">
{% csrf_token %}
{% if success == True %}
- {% if teachers|length == 1 or teachers|length == 0%}
+ {% if teachers|length == 1 or teachers|length == 0 %}
<center><h3>No results found</h3></center>
{% else %}
<center><b><u>Search Results</u></b></center><br>
diff --git a/yaksh/templates/yaksh/course_detail.html b/yaksh/templates/yaksh/course_detail.html
index 44fab21..ccb3a10 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 %} {{ course.name }} {% endblock %}
+{% block subtitle %} {% for course in courses %}{{ course.name }}{% endfor %} {% endblock %}
{% block css %}
<link rel="stylesheet" media="all" type="text/css" href="{{ URL_ROOT }}/static/yaksh/css/course.css" />
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)