diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-08-09 17:20:10 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-08-12 18:04:27 +0200 |
| commit | af30c2ee6136e2f6e693881fa4e81af76d7cb215 (patch) | |
| tree | 3c27738516c259e87376c2d1b196c8c329eb69df /addons/website_blog/controllers/main.py | |
| parent | 8517a3c3353bbfa5db596efbec226b8cd557f67e (diff) | |
[IMP] website_blog: integrate snippet latest posts
Moved from the themes repository.
Now, users can use a snippet which showcases the latest blog posts as
soon as they install the blog app.
Note: in the future we may want to develop a snippet which can showcase
any model records (products, projects, ...).
task-1874216
Diffstat (limited to 'addons/website_blog/controllers/main.py')
| -rw-r--r-- | addons/website_blog/controllers/main.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/website_blog/controllers/main.py b/addons/website_blog/controllers/main.py index 8adb6c5b9e6..f16f6ed761b 100644 --- a/addons/website_blog/controllers/main.py +++ b/addons/website_blog/controllers/main.py @@ -293,3 +293,8 @@ class WebsiteBlog(http.Controller): if not post_id: return False return request.env['blog.post'].browse(int(post_id)).write({'cover_properties': json.dumps(cover_properties)}) + + @http.route(['/blog/render_latest_posts'], type='json', auth='public', website=True) + def render_latest_posts(self, template, domain, limit=None, order='published_date desc'): + posts = request.env['blog.post'].search(domain, limit=limit, order=order) + return request.env.ref(template).render({'posts': posts}) |
