def _update_or_create_translated_texts(self, languages, reference_id, trans_text): for language in languages: translated_text.update_or_create( entity=trans_text.entity, reference=reference_id, language=language, text_label=trans_text.text_label, defaults={'text': self.cleaned_data['trans_text']} )
def update_bibliography_changed_field_in_cms(learning_unit_year): txt_label = text_label.get_by_label_or_none('bibliography') if txt_label: for language in settings.LANGUAGES: translated_text.update_or_create( entity=entity_name.LEARNING_UNIT_YEAR, reference=learning_unit_year.id, text_label=txt_label, language=language[0], defaults={})
def save(self): translated_text_upserted = [] for language in [LANGUAGE_CODE_FR, LANGUAGE_CODE_EN]: upsert_result = translated_text.update_or_create( entity=entity_name.OFFER_YEAR, reference=self.education_group_year.pk, text_label=self.cms_text_label, language=language, defaults={'text': self._get_related_text(language)}) translated_text_upserted.append(upsert_result) return translated_text_upserted
def save(self): translated_text_upserted = [] for language in [LANGUAGE_CODE_FR, LANGUAGE_CODE_EN]: upsert_result = translated_text.update_or_create( entity=entity_name.OFFER_YEAR, reference=self.education_group_year.pk, text_label=self.cms_text_label, language=language, defaults={'text': self._get_related_text(language)} ) translated_text_upserted.append(upsert_result) return translated_text_upserted