fix(blog_post): Fix for blog post having content as HTML (#7134)

* fix: Handling for HTML content type

* fix: use get_html_content_based_on_type for content

* fix: fetch content_html and content_md
This commit is contained in:
Deepesh Garg 2019-03-26 11:32:27 +05:30 committed by Faris Ansari
parent 87d5710956
commit dc28e54d47

View file

@ -162,6 +162,9 @@ def get_blog_list(doctype, txt=None, filters=None, limit_start=0, limit_page_len
t1.title, t1.name, t1.blog_category, t1.route, t1.published_on,
t1.published_on as creation,
t1.content as content,
t1.content_type as content_type,
t1.content_html as content_html,
t1.content_md as content_md,
ifnull(t1.blog_intro, t1.content) as intro,
t2.full_name, t2.avatar, t1.blogger,
(select count(name) from `tabComment`
@ -182,9 +185,12 @@ def get_blog_list(doctype, txt=None, filters=None, limit_start=0, limit_page_len
posts = frappe.db.sql(query, as_dict=1)
for post in posts:
post.content = get_html_content_based_on_type(post, 'content', post.content_type)
post.cover_image = find_first_image(post.content)
post.published = global_date_format(post.creation)
post.content = strip_html_tags(post.content[:340])
post.content = strip_html_tags(post.content)
if not post.comments:
post.comment_text = _('No comments yet')
elif post.comments==1: