pyramidchameleondeform

chameleon can not render deform form


I have used deform before with jinja engine but with chameleon i can not render my form I pass the form to the view to be rendered

 @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())

in the view i add this line

 <span tal:content="python:filter_form"></span>

and in the main function I add this line of code

deform.renderer.configure_zpt_renderer()
config.add_static_view('static_deform', 'deform:static')

Solution

  • You don't say specifically what you are getting, but from what I can see I think the issue you are facing is that your HTML form is getting escaped. If this is the case then change your template code in ../views/accounts.pt' to read:

    <span tal:content="structure: filter_form"></span>
    

    The "structure" keyword tells Chameleon to not escape the value. See http://chameleon.readthedocs.io/en/latest/reference.html#structure for more details