def show_pair(request,ref_code1, ref_code2): student1 = Student.get_by_ref_key(ref_code1) if student1: course = Course.get(student1.course_key) else: course = None student2 = Student.get_by_ref_key(ref_code2) return render_to_response('enroll/show_pair.html', RequestContext(request, { 'course': course, 'student1':student1, 'ref_code1':ref_code1, 'student2':student2, 'ref_code2':ref_code2 }))
def show(request,ref_code): student = Student.get_by_ref_key(ref_code) if student: course = Course.get(student.course_key) else: course = None return render_to_response('enroll/show.html', RequestContext(request, { 'course': course, 'student':student, 'ref_code':ref_code }))
def manual_confirm(request, ref_code=None): info = "" student = None course = None status = False if request.method == "POST": form = ConfirmForm(request.POST) if form.is_valid(): ref_code = form.cleaned_data["ref_code"] confirm_code = form.cleaned_data["confirm_code"] student = Student.get_by_ref_key(ref_code) if student is None: student = Student.get_by_confirm_key(confirm_code) if student is None: info = "Přihláška nenalezena" else: course = Course.get(student.course_key) if course is None: info = "Přihláška obsahuje neplatný kurz" else: if student.status == "n": if course.can_enroll(): student.status = "e" student.init_enroll() student.save() plan_send_student_email("ENROLL_OK_PAY_REQUEST", student) info = "Přihláška byla potvrzena a zařazena do kurzu" else: student.status = "s" student.save() plan_send_student_email("ENROLL_OK_SPARE", student) info = "Přihláška byla potvrzena a zařazena do kurzu mezi náhradníky" plan_send_enroll_form(student) plan_update_course(course) status = True elif student.status in ["e", "s"]: info = "Přihláška již byla potrzena" else: info = "Přihlášku již nelze potvrdit" else: if ref_code is None: form = ConfirmForm() else: form = ConfirmForm({"ref_code": ref_code}) return render_to_response( "admin/enroll_manual_confirm.html", RequestContext(request, {"form": form, "student": student, "course": course, "status": status, "info": info}), )