summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2016-09-16 20:29:06 +0530
committeradityacp2016-09-16 20:29:06 +0530
commitc3dd2ec955c5a2b46ea469d1aff0d3b8c1859e2e (patch)
tree396d4dad04dfdf71dc035ba0a414b4c057a00ea7 /yaksh
parentbfd75a4b87339c5037ad2d412e45ee12b223dd02 (diff)
downloadonline_test-c3dd2ec955c5a2b46ea469d1aff0d3b8c1859e2e.tar.gz
online_test-c3dd2ec955c5a2b46ea469d1aff0d3b8c1859e2e.tar.bz2
online_test-c3dd2ec955c5a2b46ea469d1aff0d3b8c1859e2e.zip
changed views to get demo course
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/views.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 6644705..6d5ac30 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -256,8 +256,9 @@ 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 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 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!')
context = {}
if request.method == "POST":
if quiz_id is None:
@@ -683,12 +684,16 @@ def courses(request):
raise Http404('You are not allowed to view this page')
try:
demo_user = User.objects.get(username="yaksh_demo_user")
- except User.DoesNotExist:
+ demo_course = Course.objects.get(creator=demo_user)
+ except User.DoesNotExist, Course.DoesNotExist:
demo_user = None
- courses = Course.objects.filter(Q(creator=user) | Q(creator=demo_user),
- is_trial=False)
+ demo_course = None
+
+ courses = Course.objects.filter(creator=user, is_trial=False)
allotted_courses = Course.objects.filter(teachers=user, is_trial=False)
- context = {'courses': courses, "allotted_courses": allotted_courses}
+
+ context = {'courses': courses, "allotted_courses": allotted_courses,
+ 'demo_course': demo_course}
return my_render_to_response('yaksh/courses.html', context,
context_instance=ci)