This module provides an experimental subclass of FieldSet to support RDFAlchemy.
>>> from rdfalchemy.samples.company import Company
>>> c = Company(stockDescription='description', symbol='FA',
... cik='cik', companyName='fa corp',
... stock=['value1'])
>>> fs = FieldSet(Company)
>>> fs.configure(options=[fs.stock.set(options=['value1', 'value2'])])
>>> fs = fs.bind(c)
>>> fs.stock.value
['value1']
>>> print fs.render().strip()
<div>
<label class="field_opt" for="Company--stockDescription">Stockdescription</label>
<input id="Company--stockDescription" name="Company--stockDescription" type="text" value="description" />
</div>
...
<div>
<label class="field_opt" for="Company--stock">Stock</label>
<select id="Company--stock" name="Company--stock">
<option selected="selected" value="value1">value1</option>
<option value="value2">value2</option>
</select>
</div>
>>> fs = Grid(Company, [c])
>>> fs.configure(options=[fs.stock.set(options=['value1', 'value2'])], readonly=True)
>>> print fs.render().strip()
<thead>
<tr>
<th>Stockdescription</th>
<th>Companyname</th>
<th>Cik</th>
<th>Symbol</th>
<th>Stock</th>
</tr>
</thead>
<tbody>
<tr class="even">
<td>description</td>
<td>fa corp</td>
<td>cik</td>
<td>FA</td>
<td>value1</td>
</tr>
</tbody>
Create a new Field object.
field name
data type, from formalchemy.types (Integer, Float, String, LargeBinary, Boolean, Date, DateTime, Time) or a custom type
default value. If value is a callable, it will be passed the current bound model instance when the value is read. This allows creating a Field whose value depends on the model once, then binding different instances to it later.