Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Odoo blog cover image not showing

By
Md. Tanzilul Hasan Khan
on 11/25/16, 2:51 AM 81 views

I have created custom latest blog template. But I can't show cover images in thumbnails.

Cover image should be here:

I have written following code to show the cover image:

<t t-set="properties" t-value="json.loads(post.cover_properties)">
<a class="o_panel_cover" t-attf-href="#{blog_url('', ['blog', 'post'], blog=post.blog_id, post=post)}" t-att-style="background-image: #{cover_properties.get('background-image')};"> </a>
</t>
<div class="panel-heading mt0 mb0">
<h4 class="mt0 mb0">
<a t-attf-href="#{blog_url('', ['blog', 'post'], blog=post.blog_id, post=post)}" t-field="post.name"></a>
<span t-if="not post.website_published" class="text-warning">
<span class="fa fa-exclamation-triangle ml8" title="Unpublished"/>
</span>
</h4>
</div>


After writing the code image not loading and it shows like this:



How can I show the image?

1

I added necessary functions in my controller and returned like this:

return request.render("website_blog.latest_blogs", {        
'posts': posts,
'pager': pager,
'blog_url': blog_url,
'blogs':blogs,
'blog_posts': blog_posts,
'blog_posts_cover_properties': [json.loads(b.cover_properties) for b in blog_posts],
})


Then the cover_properties were returned to XML.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 11/25/16, 2:51 AM
Seen: 81 times
Last updated: 12/2/16, 7:20 AM