def clean(self): cleaned_data = super(RegistrationIdForm, self).clean() registration_id = cleaned_data.get('registration_id') if registration_id: try: std_model.find_by_registration_id(registration_id) except std_model.Student.DoesNotExist: self.add_error('registration_id', _('no_student_with_this_registration_id'))
def visualize_student_attestations(request, registration_id): student = student_mdl.find_by_registration_id(registration_id) json_message = _make_registration_json_message(student.registration_id) attestation_statuses_json_dict = student_attestation_status.fetch_json_attestation_statuses( json_message) data = _make_attestation_data(attestation_statuses_json_dict, student) return layout.render(request, "attestation_home_admin.html", data)
def clean(self): cleaned_data = super(RegistrationIdForm, self).clean() registration_id = cleaned_data.get('registration_id') if registration_id: student = std_model.find_by_registration_id(registration_id) if student is None: self.add_error('registration_id', _('no_student_with_this_registration_id'))
def clean(self): cleaned_data = super(RegistrationIdForm, self).clean() registration_id = cleaned_data.get('registration_id') if registration_id: student = std_model.find_by_registration_id(registration_id) if student is None: self.add_error('registration_id', _('no student with this registration_id'))
def visualize_student_programs(request, registration_id): """ View to visualize a particular student list of academic programs. !!! Should only be accessible for staff having the rights. """ stud = student.find_by_registration_id(registration_id) list_student_programs = None if stud: list_student_programs = get_student_programs_list(stud) return layout.render(request, "performance_home.html", { "student": stud, "programs": list_student_programs })
def _import_row(cohort, row): matricule = row[7].value existing_student = student.find_by_registration_id(matricule) if existing_student: student_information = mdl_isi.InternshipStudentInformation() student_information.person = existing_student.person student_information.location = row[9].value student_information.postal_code = row[10].value student_information.city = row[11].value student_information.country = row[12].value student_information.email = row[19].value student_information.phone_mobile = row[14].value student_information.cohort = cohort student_information.save()
def _import_row(cohort, row, diff): matricule = row[7].value existing_student = student.find_by_registration_id(matricule) if existing_student: internship_student_information = mdl_isi.find_by_person( existing_student.person, cohort).first() if internship_student_information: student_information_diff = _update_information( internship_student_information, cohort, row) if (student_information_diff): diff.append(student_information_diff) else: student_information = mdl_isi.InternshipStudentInformation() student_information.person = existing_student.person _update_information(student_information, cohort, row) diff.append({ "data": student_information, "new_record": True, })
def visualize_student_programs(request, registration_id): """ View to visualize a particular student list of academic programs. !!! Should only be accessible for staff having the rights. """ stud = student.find_by_registration_id(registration_id) list_student_programs = None if stud: list_student_programs = get_student_programs_list(stud) data = { "student": stud, "programs": list_student_programs, "registration_states_to_show": offer_registration_state.STATES_TO_SHOW_ON_PAGE } return layout.render(request, "admin/performance_home_admin.html", data)
def test_find_by_registration_id(self): student = mdl_student.find_by_registration_id(self.student.registration_id) self.assertEqual(student, self.student)
def test_find_by_registration_id(self): tmp_student = StudentFactory() db_student = student.find_by_registration_id( tmp_student.registration_id) self.assertIsNotNone(db_student) self.assertEqual(db_student, tmp_student)
def test_find_by_registration_id(self): student = mdl_student.find_by_registration_id("64641200") self.assertEqual(student, self.student, "Wrong student returned") student = mdl_student.find_by_registration_id("6587984") self.assertIsNone(student, "Should return none")