summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2016-03-31 19:42:44 +0530
committeradityacp2016-04-15 14:01:51 +0530
commitc140d65ab1a3c4faa97789e08223d563cf283d25 (patch)
tree1604dc89ae0a7e66f18e4a6f8fde3eda7e5b54af /yaksh/views.py
parent234cf831861045796a7bcf4e08a46b0c38016f75 (diff)
downloadonline_test-c140d65ab1a3c4faa97789e08223d563cf283d25.tar.gz
online_test-c140d65ab1a3c4faa97789e08223d563cf283d25.tar.bz2
online_test-c140d65ab1a3c4faa97789e08223d563cf283d25.zip
changes in edit profile, enrollment, change password
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 2738a26..8001520 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -624,7 +624,8 @@ def enroll(request, course_id, user_id=None, was_rejected=False):
return my_render_to_response('yaksh/course_detail.html', {'course': course},
context_instance=ci)
else:
- course.enroll(was_rejected, *enroll_ids)
+ enroll_users = User.objects.filter(id__in=enroll_ids)
+ course.enroll(was_rejected, *enroll_users)
else:
user = get_object_or_404(User, pk=user_id)
course.enroll(was_rejected, user)
@@ -632,13 +633,22 @@ def enroll(request, course_id, user_id=None, was_rejected=False):
@login_required
-def reject(request, course_id, user_id, was_enrolled=False):
+def reject(request, course_id, user_id=None, was_enrolled=False):
user = request.user
if not is_moderator(user):
raise Http404('You are not allowed to view this page')
course = get_object_or_404(Course, creator=user, pk=course_id)
- user = get_object_or_404(User, pk=user_id)
- course.reject(was_enrolled, user)
+ if request.method == 'POST':
+ reject_ids = request.POST.getlist('check')
+ if reject_ids is None:
+ return my_render_to_response('yaksh/course_detail.html', {'course': course},
+ context_instance=ci)
+ else:
+ reject_users = User.objects.filter(id__in=reject_ids)
+ course.reject(was_enrolled, *reject_users)
+ else:
+ user = get_object_or_404(User, pk=user_id)
+ course.reject(was_enrolled, user)
return course_detail(request, course_id)
@@ -970,7 +980,6 @@ def design_questionpaper(request):
def view_profile(request):
""" view moderators and users profile """
- context = {}
user = request.user
ci = RequestContext(request)
if not user.is_authenticated():