我需要在我的Odoo网站上创建一个表单,这样外部用户就可以注册从我的Odoo发送的时事通讯。到目前为止,我已经创建了一个网站模板和一个控制器。到目前为止,我已经成功地显示了表单,做了一个Post,并预加载了许多额外的字段来填充表单,但是当我点击submit时,数据没有保存到数据库中。我看过网站的招聘模式有表格供人们填写,但我不知道数据保存在哪里以及如何保存。在
我包括以下来自我自己控制器的代码供参考:
我的控制器:
@http.route('/contact/register', type='http', auth='public', website='true')
def register(self, redirect=None, **post):
areas_interest = request.env['iica_contacts.area_interest'].sudo().search([])
topics_interest = request.env['iica_contacts.topic_interest'].sudo().search([])
products_interest = request.env['iica_contacts.products_interest'].sudo().search([])
countries = request.env['res.country'].sudo().search([])
if post:
return request.redirect('/contact/register/success')
values = {
'areas_interest' : areas_interest,
'topics_interest' : topics_interest,
'products_interest' : products_interest,
'countries' : countries,
}
return request.render("iica_contacts.register", values)
我的模板:
^{pr2}$我会非常感谢你的帮助。在
在调查和尝试了很多东西之后,我尝试了以下方法:
插入模型的函数:
^{pr2}$相关问题 更多 >
编程相关推荐