blob: f05e37f6c9b9e2aaf0901a08b2c73ff7e964eea5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
from .. import controller
from odoo import http
from odoo.http import request
class PageContent(controller.Controller):
PREFIX = '/api/v1/'
@http.route(PREFIX + 'page-content', auth='public', methods=['GET', 'OPTIONS'])
@controller.Controller.must_authorized()
def get_page_content(self, **kw):
data = None
url_path = kw.get('url_path')
page_content = request.env['website.page.content'].search([('url_path', '=', url_path)], limit=1)
if page_content:
data = {
'id': page_content.id,
'url_path': page_content.url_path,
'content': page_content.content,
}
return self.response(data=data)
|