Skip to content

Commit

Permalink
[FIX] website_blog: use related to display the image from the author …
Browse files Browse the repository at this point in the history
…from a blog without that the partner is 'website_published'.
  • Loading branch information
JKE-be committed Oct 28, 2014
1 parent 4ff1c7c commit b95b134
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 3 additions & 0 deletions addons/website_blog/models/website_blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def _compute_ranking(self, cr, uid, ids, name, arg, context=None):
'res.users', 'Last Contributor',
select=True, readonly=True,
),
'author_avatar': fields.related(
'author_id', 'image_small',
string="Avatar", type="binary"),
'visits': fields.integer('No of Views'),
'ranking': fields.function(_compute_ranking, string='Ranking', type='float'),
}
Expand Down
6 changes: 1 addition & 5 deletions addons/website_blog/views/website_blog_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@
</div>

<div t-foreach="blog_posts" t-as="blog_post" class="mb32">

<img class="img-circle pull-right mt16"
t-att-src="website.image_url(blog_post.author_id, 'image_small')"
style="width: 50px;"/>

<span t-field="blog_post.author_avatar" t-field-options='{"widget": "image", "class": "img-circle pull-right mt16 media-object"}' />
<a t-attf-href="/blog/#{ slug(blog_post.blog_id) }/post/#{ slug(blog_post) }">
<h2 t-field="blog_post.name" class="mb4"/>
</a>
Expand Down

0 comments on commit b95b134

Please sign in to comment.