Search code examples
pythondeformcolander

How to change the label content in a deform/colander form?


I have deform/colander generated html form, that contains this:

class ProductSchema(colander.Schema):
            completename = colander.SchemaNode(colander.String())

The generated form has therefore this label:

<label class="desc" title="" for="deformField1">Completename<span class="req" id="req-deformField1">*</span> 
</label> 

I would like to override the label content to have something else displayed, like "Complete name" for example.

This is a probably very trivial question but I could not find the answer in the documentation ( http://docs.pylonsproject.org/projects/deform/dev/# )


Solution

  • To the SchemaNode you can provide a title argument.

    colander.SchemaNode(colander.String(),
                        title='Complete name')