def _add_person_to_group(person): # Check Student if student.find_by_person(person): _assign_group(person, "students") # Check tutor if tutor.find_by_person(person): _assign_group(person, "tutors")
def download_student_attestation(request, global_id, academic_year, attestation_type): attestation_pdf = student_attestation.fetch_student_attestation( global_id, academic_year, attestation_type, request.user) if attestation_pdf: return _make_pdf_attestation(attestation_pdf, attestation_type) else: person = person_mdl.find_by_global_id(global_id) student = student_mdl.find_by_person(person) messages.add_message(request, messages.ERROR, _('error_fetching_attestation')) return visualize_student_attestations(request, student.registration_id)
def test_find_by_person(self): tmp_student = StudentFactory() db_student = student.find_by_person(tmp_student.person) self.assertIsNotNone(db_student) self.assertEqual(db_student, tmp_student)
def get_or_create_test_student(self, person): student = mdl_student.find_by_person(person) if not student: student = mdl_student.Student.objects.create(registration_id=123456789, person=person) return student
def get_or_create_test_student(self, person): student = mdl_student.find_by_person(person) if not student: student = mdl_student.Student.objects.create( registration_id=123456789, person=person) return student