Пример #1
0
 def __str__(self):
     if self.slug:
         return self.slug
     else:
         beginning = strip_tags(truncate_html_words(self.content, 5))
         if beginning:
             return beginning
         else:
             img_count = self.content.lower().count('<img')
             if img_count:
                 return "%s #%d (%s Images, no text)" % (type(self).__name__, self.id, img_count,)
             else:
                 return "%s #%d" % (type(self).__name__, self.id,)
Пример #2
0
 def __str__(self):
     if self.slug:
         return self.slug
     else:
         beginning = strip_tags(truncate_html_words(self.content, 5))
         if beginning:
             return beginning
         else:
             img_count = self.content.lower().count('<img')
             if img_count:
                 return "%s #%d (%s Images, no text)" % (
                     type(self).__name__,
                     self.id,
                     img_count,
                 )
             else:
                 return "%s #%d" % (
                     type(self).__name__,
                     self.id,
                 )
Пример #3
0
 def __unicode__(self):
     if self.slug:
         return self.slug
     else:
         return strip_tags(truncate_html_words(self.content, 5))
Пример #4
0
 def content_preview(self, obj):
     return strip_tags(truncate_html_words(obj.content, 5))
Пример #5
0
 def content_preview(self, obj):
     return strip_tags(truncate_html_words(obj.content, 5))