diff options
author | adityacp | 2016-09-19 14:47:09 +0530 |
---|---|---|
committer | adityacp | 2016-09-19 14:47:09 +0530 |
commit | 4bc766cb85fd999a8e2ac6d7e87e62730edb1244 (patch) | |
tree | b9fb896d2893d016e7e0919a3c58eb1998e53d8b /yaksh/views.py | |
parent | 89376074f8dcee778dfc43587d623d4e8d1b5520 (diff) | |
download | online_test-4bc766cb85fd999a8e2ac6d7e87e62730edb1244.tar.gz online_test-4bc766cb85fd999a8e2ac6d7e87e62730edb1244.tar.bz2 online_test-4bc766cb85fd999a8e2ac6d7e87e62730edb1244.zip |
removed string comparison for demo course
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 6d5ac30..3e42b64 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -256,9 +256,15 @@ def add_quiz(request, course_id, quiz_id=None): user = request.user course = get_object_or_404(Course, pk=course_id) ci = RequestContext(request) - if course.name != "Yaksh_Demo_course": - if not is_moderator(user) or (user != course.creator and user not in course.teachers.all()): - raise Http404('You are not allowed to view this page!') + if not is_moderator(user): + raise Http404('You are not allowed to view this page!') + try: + demo_user = User.objects.get(username="yaksh_demo_user") + except User.DoesNotExist: + demo_user = None + if course.creator != demo_user: + if (user != course.creator and user not in course.teachers.all()): + raise Http404('You are not allowed to view this course !') context = {} if request.method == "POST": if quiz_id is None: |