Authors: | Gael Pasgrimaud |
---|---|
Date: | $Date: 2009-05-25$ |
>>> from sqlalchemy import * >>> metadata = MetaData() >>> users_table = Table('users', metadata, ... Column('id', Integer, primary_key=True), ... Column('name', String), ... Column('fullname', String), ... Column('password', String) ... )
>>> from sqlalchemy.orm import mapper >>> class User(object): pass >>> m = mapper(User, users_table)
>>> from formalchemy import FieldSet >>> html = FieldSet(User()).render() >>> print html.strip() #doctest: +ELLIPSIS <div> <label class="field_opt" for="User--name">Name</label> <input id="User--name" name="User--name" type="text" /> </div> <script type="text/javascript"> //<![CDATA[ document.getElementById("User--name").focus(); //]]> </script> <div> <label class="field_opt" for="User--fullname">Fullname</label> <input id="User--fullname" name="User--fullname" type="text" /> </div> ...