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,)
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, )
def __unicode__(self): if self.slug: return self.slug else: return strip_tags(truncate_html_words(self.content, 5))
def content_preview(self, obj): return strip_tags(truncate_html_words(obj.content, 5))