|
|
FormAlchemy
Auto-generated, customizable HTML input form fields from your SQLAlchemy mapped classes.
FormAlchemy is a library written in Python that generates HTML form fields from your SQLAlchemy mapped classes.
If you are using SQLAlchemy in a web environment requiring user input for your database(s), chances are that you will feel writing the same code for your HTML forms than the code you wrote for your SQLAlchemy tables. If you are tired of writing, updating, validating your HTML forms over and over again, FormAlchemy might get most of the work done for you. Get the tedious job done faster and easier without feeling to repeat yourself. FormAlchemy reflects your database tables to HTML forms.
FormAlchemy is easy to use and nicely integrates in your web framework or templates. It is highly customizable generating HTML code that fits your needs. Have a look at the QuickTutorial to get an idea of FormAlchemy's usage.
FormAlchemy is built on top of WebHelpers and SQLAlchemy, so these two packages are required for FormAlchemy to work.
Features
- Generates HTML form fields from SQLAlchemy mapped classes.
- Pre-fills input fields with current or default value.
- Highly customizable HTML output.
- Alleviates your templates.
- Changes at the table level are automaticly reflected in your HTML forms.
- Validates user's input (TODO).
- One, easy-to-use, method.
- SQLAlchemy 0.3 and 0.4 compatible.
- Elixir compatible.
In a nutshell
from sqlalchemy import *
from sqlalchemy.orm import *
from formalchemy import FieldSet
meta = MetaData()
user_table = Table('users', meta,
Column('email', Unicode(40), primary_key=True),
Column('name', Unicode(20)),
Column('active', Boolean, default=True),
)
class User(object):
pass
mapper(User, user_table)
user = User()
print FieldSet(user).render() ### FormAlchemy starts here.
<fieldset>
<legend>User</legend>
<div>
<label class="field_req" for="email">Email</label>
<input id="email" maxlength="40" name="email" type="text" />
</div>
<div>
<label class="field_opt" for="name">Name</label>
<input id="name" maxlength="20" name="name" type="text" />
</div>
<div>
<label class="field_opt" for="active">Active</label>
<input checked="checked" id="active" name="active" type="checkbox" value="True" />
</div>
</fieldset>Download FormAlchemy
Current version: 0.2
Install FormAlchemy
Check out the instructions for InstallingFormAlchemy.
Quick tutorial
FormAlchemy's QuickTutorial will get you started in minutes!
Documentation
FormAlchemy's documentation is available here.
License
FormAlchemy is released under the MIT License.
Copyright
Copyright (C) 2007 Alexandre Conrad, aconard(dot.)tlv(at@)magic(dot.)fr
