def convert_to_articlereply(articles, message): reply = ArticlesReply(message=message) from blog.templatetags.blog_tags import truncatechars_content for post in articles: imgs = re.findall(r'(?:http\:|https\:)?\/\/.*\.(?:png|jpg)', post.body) imgurl = '' if imgs: imgurl = imgs[0] article = Article(title=post.title, description=truncatechars_content(post.body), img=imgurl, url=post.get_full_url()) reply.add_article(article) return reply
def convert_to_articlereply(articles, message): reply = ArticlesReply(message=message) from blog.templatetags.blog_tags import custom_markdown, truncatechars_content from web.utils import CommonMarkdown from django.utils.safestring import mark_safe for post in articles: imgs = re.findall(r'(?:http\:|https\:)?\/\/.*\.(?:png|jpg)', post.body) imgurl = '' if imgs: imgurl = imgs[0] article = Article(title=post.title, description=truncatechars_content(post.body), img=imgurl, url=post.get_full_url()) reply.add_article(article) return reply
def convert_to_articlereply(articles, message): reply = ArticlesReply(message=message) from blog.templatetags.blog_tags import custom_markdown, truncatechars_content from DjangoBlog.utils import CommonMarkdown from django.utils.safestring import mark_safe for post in articles: imgs = re.findall(r'(?:http\:|https\:)?\/\/.*\.(?:png|jpg)', post.body) imgurl = '' if imgs: imgurl = imgs[0] article = Article( title=post.title, description=truncatechars_content(post.body), img=imgurl, url=post.get_full_url() ) reply.add_article(article) return reply