См.также
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Person(Base):
__tablename__ = 'person'
id = Column(Integer, primary_key=True)
name = Column(String(250), nullable=False)
def __repr__(self):
return "<{}>".format(self.name)
from colanderalchemy import SQLAlchemySchemaNode
person = SQLAlchemySchemaNode(Person)
from deform import Form
form = Form(person, buttons=('submit',))
print(form.render()) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | <form
id="deform"
method="POST"
enctype="multipart/form-data"
accept-charset="utf-8" class="deform"
>
<fieldset class="deformFormFieldset">
<input type="hidden" name="_charset_" />
<input type="hidden" name="__formid__" value="deform"/>
<ul>
<li class="field item-id "
title=""
id="item-deformField1">
<!-- mapping_item -->
<label
class="desc"
title=""
for="deformField1"
>Id
</label>
<input type="text" name="id" value=""
id="deformField1"/>
<!-- /mapping_item -->
</li>
</ul>
<ul>
<li class="field item-name "
title=""
id="item-deformField2">
<!-- mapping_item -->
<label
class="desc"
title=""
for="deformField2"
>Name<span class="req"
id="req-deformField2">*</span>
</label>
<input type="text" name="name" value=""
id="deformField2"/>
<!-- /mapping_item -->
</li>
</ul>
<ul>
<li class="buttons">
<button
id="deformsubmit"
name="submit"
type="submit"
class="btnText submit "
value="submit">
<span>Submit</span>
</button>
</li>
</ul>
</fieldset>
</form> |