summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2018-01-17 17:23:48 +0530
committeradityacp2018-01-17 17:23:48 +0530
commitef9b17ffcf89a3ce90930f7ce4e91b481ad2a53a (patch)
treee55b42d29fb19a83c9c7afe5a71cb6978873a8d1 /yaksh/views.py
parent8006ffb4a5bd54aa960b24f1508d95844fa579de (diff)
downloadonline_test-ef9b17ffcf89a3ce90930f7ce4e91b481ad2a53a.tar.gz
online_test-ef9b17ffcf89a3ce90930f7ce4e91b481ad2a53a.tar.bz2
online_test-ef9b17ffcf89a3ce90930f7ce4e91b481ad2a53a.zip
Change views.py and test_views.py
- Add a condition to disallow a teacher to become course creator - Add test to check if a teacher does not become course creator
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 21c79f3..61bca4c 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -932,14 +932,14 @@ def add_course(request, course_id=None):
raise Http404("You are not allowed to view this course")
else:
course = None
-
if not is_moderator(user):
raise Http404('You are not allowed to view this page')
if request.method == 'POST':
form = CourseForm(request.POST, instance=course)
if form.is_valid():
new_course = form.save(commit=False)
- new_course.creator = user
+ if course_id is None:
+ new_course.creator = user
new_course.save()
return my_redirect('/exam/manage/courses')
else: