From cfc3b46c5c16772fcaf637aa321364bcf733d02b Mon Sep 17 00:00:00 2001 From: Diana Huang <dkh@edx.org> Date: Fri, 1 Aug 2014 14:25:42 -0400 Subject: [PATCH] Allow verified to be offered without audit --- common/djangoapps/course_modes/views.py | 1 + common/djangoapps/student/views.py | 8 +++++++- lms/djangoapps/verify_student/views.py | 9 +++++++-- lms/templates/verify_student/_verification_support.html | 2 ++ lms/templates/verify_student/show_requirements.html | 2 ++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/common/djangoapps/course_modes/views.py b/common/djangoapps/course_modes/views.py index f7faaeb60d3..8ed767e499f 100644 --- a/common/djangoapps/course_modes/views.py +++ b/common/djangoapps/course_modes/views.py @@ -60,6 +60,7 @@ class ChooseModeView(View): "chosen_price": chosen_price, "error": error, "upgrade": upgrade, + "can_audit": "audit" in modes, } if "verified" in modes: context["suggested_prices"] = [ diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index edcf9278cea..2d413141700 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -632,10 +632,16 @@ def change_enrollment(request): available_modes = CourseMode.modes_for_course(course_id) if len(available_modes) > 1: return HttpResponse( - reverse("course_modes_choose", kwargs={'course_id': course_id.to_deprecated_string()}) + reverse("course_modes_choose", kwargs={'course_id': unicode(course_id)}) ) current_mode = available_modes[0] + # only automatically enroll people if the only mode is 'honor' + if current_mode.slug != 'honor': + return HttpResponse( + reverse("course_modes_choose", kwargs={'course_id': unicode(course_id)}) + ) + CourseEnrollment.enroll(user, course.id, mode=current_mode.slug) return HttpResponse() diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index 015e4b4e225..839da9cdb7c 100644 --- a/lms/djangoapps/verify_student/views.py +++ b/lms/djangoapps/verify_student/views.py @@ -74,7 +74,8 @@ class VerifyView(View): # bookkeeping-wise just to start over. progress_state = "start" - verify_mode = CourseMode.mode_for_course(course_id, "verified") + modes_dict = CourseMode.modes_for_course_dict(course_id) + verify_mode = modes_dict['verified'] # if the course doesn't have a verified mode, we want to kick them # from the flow if not verify_mode: @@ -102,6 +103,7 @@ class VerifyView(View): "chosen_price": chosen_price, "min_price": verify_mode.min_price, "upgrade": upgrade, + "can_audit": "audit" in modes_dict, } return render_to_response('verify_student/photo_verification.html', context) @@ -121,7 +123,9 @@ class VerifiedView(View): course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id) if CourseEnrollment.enrollment_mode_for_user(request.user, course_id) == ('verified', True): return redirect(reverse('dashboard')) - verify_mode = CourseMode.mode_for_course(course_id, "verified") + + modes_dict = CourseMode.modes_for_course_dict(course_id) + verify_mode = modes_dict['verified'] if verify_mode is None: return redirect(reverse('dashboard')) @@ -146,6 +150,7 @@ class VerifiedView(View): "chosen_price": chosen_price, "create_order_url": reverse("verify_student_create_order"), "upgrade": upgrade, + "can_audit": "audit" in modes_dict, } return render_to_response('verify_student/verified.html', context) diff --git a/lms/templates/verify_student/_verification_support.html b/lms/templates/verify_student/_verification_support.html index b7263603ae7..de54e633468 100644 --- a/lms/templates/verify_student/_verification_support.html +++ b/lms/templates/verify_student/_verification_support.html @@ -10,6 +10,7 @@ </div> </li> + %if can_audit: <li class="help-item help-item-coldfeet"> %if upgrade: <h3 class="title">${_("Change your mind?")}</h3> @@ -23,6 +24,7 @@ </div> %endif </li> + %endif <li class="help-item help-item-technical"> <h3 class="title">${_("Technical Requirements")}</h3> diff --git a/lms/templates/verify_student/show_requirements.html b/lms/templates/verify_student/show_requirements.html index 97b89ba07f3..c88c5f0b7ac 100644 --- a/lms/templates/verify_student/show_requirements.html +++ b/lms/templates/verify_student/show_requirements.html @@ -156,11 +156,13 @@ <nav class="nav-wizard ${"is-not-ready" if is_not_active else "is-ready"}"> + %if can_audit: %if upgrade: <span class="help help-inline">${_("Missing something? You can always continue to audit this course instead.")}</span> %else: <span class="help help-inline">${_("Missing something? You can always {a_start}audit this course instead{a_end}").format(a_start='<a href="{}">'.format(course_modes_choose_url), a_end="</a>")}</span> %endif + %endif <ol class="wizard-steps"> <li class="wizard-step"> -- GitLab