def get_description(self): object = self.object ### Assign variables ----------------------- site_name = get_setting('site','global','sitedisplayname') geo_location = get_setting('site','global','sitegeographiclocation') if object.description: content = object.description content = strip_tags(content) #strips HTML tags content = unescape_entities(content) content = content.replace("\n","").replace("\r","") content = truncate_words(content, 50) # ~ about 250 chars ### Build string ----------------------- value = object.name value = '%s : %s' % (value, content) value = '%s Photo Sets for %s, %s' % ( value, site_name, geo_location) value = value.strip() return value
def get_description(self): # TODO: Optimize this SEM algorithm description = self.object.description description = strip_html(description) description = truncate_words(description, 40, '') return description
def get_description(self): object = self.object ### Assign variables ----------------------- primary_keywords = get_setting('site','global','siteprimarykeywords') category_set = object.category_set category = category_set.get('category', '') subcategory = category_set.get('sub_category', '') site_name = get_setting('site','global','sitedisplayname') geo_location = get_setting('site','global','sitegeographiclocation') creator_name = '' if object.creator: creator_name = '%s %s' % ( object.creator.first_name, object.creator.last_name ) creator_name = creator_name.strip() if object.summary: content = object.summary else: content = object.body content = strip_tags(content) #strips HTML tags content = unescape_entities(content) content = content.replace("\n","").replace("\r","") content = truncate_words(content, 50) # ~ about 250 chars ### Build string ----------------------- value = object.headline if creator_name: value = '%s %s' % (value, creator_name) value = '%s : %s' % (value, content) if primary_keywords: value = '%s %s' % (value, primary_keywords) else: if category: value = '%s %s' % (value, category) if category and subcategory: value = '%s : %s' % (value, subcategory) value = '%s directory' % value value = '%s Directories for %s %s' % ( value, site_name, geo_location) value = value.strip() return value
def get_description(self): object = self.object ### Assign variables ----------------------- primary_keywords = get_setting('site','global','siteprimarykeywords') category_set = object.category_set category = ', '.join([cat.name for cat in object.cats.all()]) subcategory = ', '.join([sub_cat.name for sub_cat in object.sub_cats.all()]) site_name = get_setting('site','global','sitedisplayname') geo_location = get_setting('site','global','sitegeographiclocation') if object.summary: content = object.summary else: content = object.body content = strip_tags(content) #strips HTML tags content = unescape_entities(content) content = content.replace("\n","").replace("\r","") content = truncate_words(content, 50) # ~ about 250 chars ### Build string ----------------------- value = object.headline value = '%s : %s' % (value, content) if primary_keywords: value = '%s %s' % (value, primary_keywords) else: if category: value = '%s %s' % (value, category) if category and subcategory: value = '%s : %s' % (value, subcategory) value = '%s Directories for %s %s' % ( value, site_name, geo_location) value = value.strip() return value
def get_description(self): object = self.object ### Assign variables ----------------------- category = Category.objects.get_for_object(object, 'category') subcategory = Category.objects.get_for_object(object, 'subcategory') site_name = get_setting('site','global','sitedisplayname') geo_location = get_setting('site','global','sitegeographiclocation') content = object.content content = strip_tags(content) #strips HTML tags content = unescape_entities(content) content = content.replace("\n","").replace("\r","") content = truncate_words(content, 50) # ~ about 250 chars ### Build string ----------------------- value = object.title value = '%s - %s' % (value, content) if site_name: value = '%s %s' % (value, site_name) else: if category: value = '%s, %s' % (value, category) if category and subcategory: value = '%s, %s' % (value, subcategory) value = '%s ' % value value = '%s %s %s' % ( value, site_name, geo_location) value = value.strip() return value
def overview_parsed(self, obj): overview = strip_tags(obj.overview) overview = truncate_words(overview, 50) return overview