def load_initial(self): value_fr = translated_text.get_or_create( entity=entity_name.LEARNING_UNIT_YEAR, reference=self.learning_unit_year.id, language='fr-be', text_label=self.text_label) value_en = translated_text.get_or_create( entity=entity_name.LEARNING_UNIT_YEAR, reference=self.learning_unit_year.id, language='en', text_label=self.text_label) self.fields['cms_fr_id'].initial = value_fr.id self.fields['trans_text_fr'].initial = value_fr.text self.fields['cms_en_id'].initial = value_en.id self.fields['trans_text_en'].initial = value_en.text
def load_initial(self): value = translated_text.get_or_create(entity=entity_name.LEARNING_UNIT_YEAR, reference=self.learning_unit_year.id, language=self.language_iso, text_label=self.text_label) self.fields['cms_id'].initial = value.id self.fields['trans_text'].initial = value.text
def _get_or_create_translated_text(self, language): return translated_text.get_or_create( entity=entity_name.LEARNING_UNIT_YEAR, reference=self.learning_unit_year.id, language=language, text_label=self.text_label )
def load_initial(self): value = translated_text.get_or_create( entity=entity_name.LEARNING_UNIT_YEAR, reference=self.learning_unit_year.id, language=self.language_iso, text_label=self.text_label) self.fields['cms_id'].initial = value.id self.fields['trans_text'].initial = value.text
def load_initial(self): value = translated_text.get_or_create( entity=entity_name.OFFER_YEAR, reference=self.education_group_year.id, language=self.language_iso, text_label=self.text_label) self.fields['cms_id'].initial = value.id self.fields['trans_text'].initial = value.text
def _get_or_create_translated_text(self): if hasattr(self, 'cleaned_data'): cms_id = self.cleaned_data['cms_id'] return translated_text.find_by_id(cms_id) return translated_text.get_or_create( entity=entity_name.LEARNING_UNIT_YEAR, reference=self.learning_unit_year.id, language=self.language_iso, text_label=self.text_label )