Example #1
0
 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)
Example #2
0
 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)
Example #3
0
    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
Example #4
0
    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
Example #5
0
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
Example #6
0
 def very_short_title(self):
     tit = u"%s - %s" % (self.identifier(), self.short_title())
     return safe_truncate(tit, 60)
Example #7
0
 def short_description(self, obj):
     return safe_truncate(obj.description, 60)
Example #8
0
 def short_title(self):
     return safe_truncate(self.title, 120)
Example #9
0
 def short_text(self):
     return safe_truncate(self.text, 240)
Example #10
0
 def short_text(self, obj):
     return safe_truncate(obj.text)
Example #11
0
 def very_short_title(self):
     tit = u'%s - %s' % (self.identifier(), self.short_title())
     return safe_truncate(tit, 60)
Example #12
0
 def short_title(self):
     return safe_truncate(self.main_title(), 120)
Example #13
0
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
Example #14
0
 def short_text(self, obj):
     return safe_truncate(obj.text)
Example #15
0
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
Example #16
0
 def __unicode__(self):
     return safe_truncate(self.name, 120)
Example #17
0
 def __unicode__(self):
     return safe_truncate(self.description, 80)
Example #18
0
 def __unicode__(self):
     return safe_truncate(self.name, 120)
Example #19
0
 def short_title(self):
     return safe_truncate(self.main_title(), 120)
Example #20
0
 def __unicode__(self):
     return safe_truncate(self.description, 80)
Example #21
0
 def short_title(self):
     return safe_truncate(self.title, 120)
Example #22
0
 def short_text(self):
     return safe_truncate(self.text, 240)