diff options
author | adityacp | 2016-03-31 19:42:44 +0530 |
---|---|---|
committer | adityacp | 2016-04-15 14:01:51 +0530 |
commit | c140d65ab1a3c4faa97789e08223d563cf283d25 (patch) | |
tree | 1604dc89ae0a7e66f18e4a6f8fde3eda7e5b54af /yaksh/views.py | |
parent | 234cf831861045796a7bcf4e08a46b0c38016f75 (diff) | |
download | online_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.py | 19 |
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(): |