123456789101112131415161718192021222324252627282930313233 |
- from odoo import http
- from odoo.http import request
- class CustomSnippets(http.Controller):
- @http.route(['/prime_latest_news_snippet/cart_content'], type='json', auth="public", website=True)
- def cart(self):
-
-
-
-
-
-
-
- sql_query = """
- select
- bp.name,
- bp.subtitle,
- concat('/blog/', lower(REPLACE(bb.name,' ', '-')) , '-' , bb.id , '/' , lower(REPLACE(bp.name,' ', '-')) , '-' , bp.id ) as post_url,
- left(split_part(bp.cover_properties , 'url(''', 2), strpos(split_part(bp.cover_properties , 'url(''', 2), ''')"') - 1) as post_image
- from blog_post bp
- left join blog_blog bb on (bb.id = bp.blog_id)
- order by bp.id desc
- limit 3
- ;
- """
- request.env.cr.execute(sql_query)
- posts = request.env.cr.dictfetchall()
- return request.env['ir.ui.view']._render_template('prime_latest_news_snippet.s_latest_news_area',
- {'posts': posts})
|