예제 #1
0
def get_contacts(education_group_year, language_code):
    contacts = business.get_contacts_group_by_types(education_group_year, language_code)
    intro_content = business.get_contacts_intro_text(education_group_year, language_code)
    entity_version = education_group_year.publication_contact_entity_version

    return {
        'id': business.CONTACTS_KEY,
        'label': business.CONTACTS_KEY,
        'content': {
            'text': intro_content,
            'entity': entity_version.acronym if entity_version else None,
            'contacts': contacts
        }
    }
예제 #2
0
 def test_get_contacts_intro_text_case_english_version(self):
     intro_text = business.get_contacts_intro_text(self.education_group_year, settings.LANGUAGE_CODE_EN)
     self.assertEqual(intro_text, self.contact_intro_en.text)
예제 #3
0
 def test_get_contacts_intro_text_case_no_value(self):
     education_group_year = EducationGroupYearFactory()
     self.assertIsNone(business.get_contacts_intro_text(education_group_year, settings.LANGUAGE_CODE_FR))
예제 #4
0
 def get_text(self, obj):
     text = get_contacts_intro_text(obj, self.context.get('lang'))
     return text if text else None