Schematics Model to WTForm converter


License
BSD-3-Clause
Install
pip install schematics-wtf==0.1.5.9

Documentation

schematics-wtf

Convert Schematics Models to WTForms

In action ...

from schematics.models import Model
from schematics.types.base import StringType, IntType
from schematics_wtf.converter import model_form

class Test(Model):
    pk = StringType(required=True)
    name = StringType()
    age = IntType()
    country = StringType(default='US', choices=['US','UK'])

test = Test(dict(name="Dude",age=35,pk="saweet")))
TestForm = model_form(test, hidden=['pk'])
form = TestForm()

print form.name.label
print form.name()

returns

<label for="name">name</label>
<input id="name" name="name" type="text" value="Dude">