def test_is_local_language_exam_needed_status(self): self.assertFalse(common.is_local_language_exam_needed(None)) self.assertFalse(common.is_local_language_exam_needed(self.user)) an_application = data_model.create_application(self.applicant) self.assertFalse(common.is_local_language_exam_needed(self.user)) an_application.offer_year.grade_type = data_model.create_grade_type('BACHELOR', institutional_grade_type.BACHELOR) an_application.offer_year.save() self.assertTrue(common.is_local_language_exam_needed(self.user)) an_application.offer_year.grade_type = data_model.create_grade_type('BACHELORZ', None) an_application.offer_year.save() self.assertFalse(common.is_local_language_exam_needed(self.user))
def test_is_local_language_exam_needed_status(self): self.assertFalse(common.is_local_language_exam_needed(None)) self.assertFalse(common.is_local_language_exam_needed(self.user)) an_application = admission.tests.models.test_application.create_application(self.applicant) self.assertFalse(common.is_local_language_exam_needed(self.user)) an_application.offer_year.grade_type = reference.tests.models.test_grade_type.create_grade_type('BACHELOR', institutional_grade_type.BACHELOR) an_application.offer_year.save() self.assertTrue(common.is_local_language_exam_needed(self.user)) an_application.offer_year.grade_type = reference.tests.models.test_grade_type.create_grade_type('BACHELORZ', None) an_application.offer_year.save() self.assertFalse(common.is_local_language_exam_needed(self.user))
def applications(request, application_id=None): application_list = mdl.application.find_by_user(request.user) if application_id: application = mdl.application.find_by_id(application_id) else: # application = mdl.application.init_application(request.user) application = None applicant = mdl.applicant.find_by_user(request.user) person_legal_address = mdl.person_address.find_by_person_type(applicant, 'LEGAL') countries = mdl_reference.country.find_all() a_domain = None a_parent_domain = None if application and application.offer_year: a_domain = mdl_base.offer_year_domain.find_by_offer_year(application.offer_year) a_parent_domain = a_domain.domain.parent data = { "applications": application_list, "grade_choices": enum_institutional_grade_type.INSTITUTIONAL_GRADE_CHOICES, "domains": mdl_reference.domain.find_current_domains(), 'tab_active': navigation.DEMAND_TAB, "application": application, "local_language_exam_needed": common.is_local_language_exam_needed(request.user), "applicant": applicant, "person_legal_address": person_legal_address, "countries": countries, "domain": a_domain, "parent_domain": a_parent_domain } data.update(demande_validation.get_validation_status(application, applicant)) return render(request, "admission_home.html", data)
def get_local_language_exam(request, secondary_education): local_language_exam = None if not(common.is_local_language_exam_needed(request.user) and request.POST.get('local_language_exam') is None): if request.POST.get('local_language_exam') == FIELD_TRUE_STATUS: local_language_exam = mdl.secondary_education_exam.find_by_type(secondary_education, LANGUAGE_EXAM_TYPE) if local_language_exam is None: local_language_exam = mdl.secondary_education_exam.SecondaryEducationExam() local_language_exam.type = 'LANGUAGE' local_language_exam.secondary_education = secondary_education local_language_exam.exam_date = None if not(request.POST.get('local_language_exam_date') is None or len(request.POST.get('local_language_exam_date').strip()) == 0): try: local_language_exam.exam_date = datetime\ .strptime(request.POST.get('local_language_exam_date'), '%d/%m/%Y') except ValueError: local_language_exam.exam_date = None local_language_exam.institution = None if not(request.POST.get('local_language_exam_institution') is None or len(request.POST.get('local_language_exam_institution').strip()) == 0): local_language_exam.institution = request\ .POST.get('local_language_exam_institution') if request.POST.get('local_language_exam_result') is None: local_language_exam.result = None else: local_language_exam.result = request.POST.get('local_language_exam_result') return local_language_exam
def get_prerequis_data(request, saved, application_id): message_info = "" if saved: message_info = _('msg_info_saved') if application_id: application = mdl.application.find_by_id(application_id) else: application = mdl.application.find_first_by_user(request.user) applicant = mdl.applicant.find_by_user(request.user) other_language_regime = mdl_reference.language.find_unrecognized_languages() recognized_languages = mdl_reference.language.find_recognized_languages() exam_types = mdl.admission_exam_type.find_all_by_adhoc(False) secondary_education = mdl.secondary_education.find_by_person(applicant) education_type_transition = mdl_reference.education_type.find_education_type_by_adhoc('TRANSITION', False) education_type_qualification = mdl_reference.education_type.find_education_type_by_adhoc('QUALIFICATION', False) local_language_exam_link = mdl.properties.find_by_key('PROFESSIONAL_EXAM_LINK') professional_exam_link = mdl.properties.find_by_key('LOCAL_LANGUAGE_EXAM_LINK') countries = mdl_reference.country.find_excluding("BE") current_academic_year = mdl_base.academic_year.current_academic_year() academic_years = [] if current_academic_year: upper_bound = current_academic_year.year low_bound = upper_bound - NB_YEARS_AVAILABLE_FOR_DIPLOMA_ACQUISITION year_cpt = low_bound while year_cpt <= upper_bound: academic_years.append(year_cpt) year_cpt = year_cpt + 1 current_year = None if current_academic_year: current_year = current_academic_year.year data = {"application": application, "academic_years": academic_years, "secondary_education": secondary_education, "countries": countries, "recognized_languages": recognized_languages, "languages": other_language_regime, "exam_types": exam_types, 'local_language_exam_link': local_language_exam_link, "professional_exam_link": professional_exam_link, "education_type_transition": education_type_transition, "education_type_qualification": education_type_qualification, "current_academic_year": current_year, "local_language_exam_needed": common.is_local_language_exam_needed(request.user), 'tab_active': navigation.PREREQUISITES_TAB, 'applications': mdl.application.find_by_user(request.user), 'message_info': message_info} # merge dictionaries data.update(get_secondary_education_exams(secondary_education)) data.update(get_secondary_education_files(application)) data.update(demande_validation.get_validation_status(application, applicant)) return data