我之前使用过jinja引擎变形但是变色龙我无法渲染我的形状 我将表单传递给要呈现的视图
public function apply_for_work_check()
{
$result=array();
$variable = $this->input->post('Infrashtructure');
foreach($variable as $var){
$data = array('id' =>null,'works_id' => 1,
'infrashtructure_name' => json_encode($var));
$result[]=$this->db->insert('infrashtructure_txn_info',$data);
}
if(count($result)==array_sum($result)) {#checks if all was TRUE
return TRUE;
} else {
return FALSE;
}
}
在视图中我添加了这一行
@view_config(route_name='home_cms',
renderer='../views/accounts.pt',
request_method='GET',
)
def home(self):
model = Bundle("ModelAccounts", xx.account_id,
xx.name, xx.state, xx.account_type)
cm_filters = xxx(self.request.db)
list_accounts = xxx.search(model=model)
return dict(list_accounts=list_accounts, filter_form=self.form.render())
在主函数中我添加了这行代码
<span tal:content="python:filter_form"></span>
答案 0 :(得分:1)
你没有具体说明你得到了什么,但从我所看到的,我认为你面临的问题是你的HTML表格正在逃脱。如果是这种情况,请在../views/accounts.pt'中更改模板代码;阅读:
<span tal:content="structure: filter_form"></span>
&#34;结构&#34;关键字告诉Chameleon不要逃避价值。有关详细信息,请参阅http://chameleon.readthedocs.io/en/latest/reference.html#structure