def short_title(self): if self.scientific_acronym: tit = u'%s - %s' % (self.scientific_acronym, self.scientific_title) else: tit = self.scientific_title return safe_truncate(tit, 80)
def short_title(self): scientific_title = self.scientific_title if scientific_title == '': trans = self.translations.filter(language=self.submission.language) if len(trans) > 0: scientific_title = trans[0].scientific_title if self.scientific_acronym: tit = u'%s - %s' % (self.scientific_acronym, scientific_title) else: tit = scientific_title return safe_truncate(tit, 120)
def objects_with_title_translated(): # TODO for #125: Change this to a better solution for obj in submission_list: obj['title'] = obj['trial__scientific_title'] try: #t = obj.trial.translations.get(language=request.LANGUAGE_CODE) t = ClinicalTrialTranslation.objects.get_translation_for_object( request.LANGUAGE_CODE, model=ClinicalTrial, object_id=obj['trial__pk'], ) if t.scientific_title != '': obj['title'] = t.scientific_title except ObjectDoesNotExist: pass # Forces a safe trancate obj['short_title'] = safe_truncate(obj['title'], 120) yield obj
def objects_with_title_translated(): # TODO for #125: Change this to a better solution for obj in submission_list: if obj['trial__scientific_title']: obj['title'] = obj['trial__scientific_title'] try: #t = obj.trial.translations.get(language=request.LANGUAGE_CODE) t = ClinicalTrialTranslation.objects.get_translation_for_object( request.LANGUAGE_CODE.lower(), model=ClinicalTrial, object_id=obj['trial__pk'], ) if t.scientific_title != '': obj['title'] = t.scientific_title except ObjectDoesNotExist: pass # Forces a safe truncate obj['short_title'] = safe_truncate(obj['title'], 120) yield obj
def length_truncate(text, max_size=240): text = text.split("|") size = max_size / len(text) text = "|".join([safe_truncate(t, size, "") for t in text]) return text
def very_short_title(self): tit = u"%s - %s" % (self.identifier(), self.short_title()) return safe_truncate(tit, 60)
def short_description(self, obj): return safe_truncate(obj.description, 60)
def short_title(self): return safe_truncate(self.title, 120)
def short_text(self): return safe_truncate(self.text, 240)
def short_text(self, obj): return safe_truncate(obj.text)
def very_short_title(self): tit = u'%s - %s' % (self.identifier(), self.short_title()) return safe_truncate(tit, 60)
def short_title(self): return safe_truncate(self.main_title(), 120)
def length_truncate(text, max_size=240): text = text.split('|') size = max_size / len(text) text = '|'.join([safe_truncate(t, size, '') for t in text]) return text
def length_truncate(text, max_size=240): text = text.split('|') size=max_size/len(text) text = '|'.join([safe_truncate(t,size,'') for t in text]) return text
def __unicode__(self): return safe_truncate(self.name, 120)
def __unicode__(self): return safe_truncate(self.description, 80)