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 )
def save(self): cleaned_data = self.cleaned_data trans_text = translated_text.find_by_id(cleaned_data['cms_id']) trans_text.text = cleaned_data.get('trans_text') trans_text.save()
def _save_text_language(self, language): trans_text = translated_text.find_by_id( self.cleaned_data['cms_' + language + '_id']) trans_text.text = self.cleaned_data.get('trans_text_' + language) trans_text.save()