A PloneFormGen Action Adapter for SQL storage
This product allows to store PloneFormGen form data in a MySQL database. (It may also work for other SQL dialects also.)
You could also save PFG data in SQL by using a Z SQL Method as an after-validation script, as described in the SQL-CRUD-tutorial. This works, but:
- it’s a lot of manual work, and quite cumbersome for ordinary users
- it doesn’t work with collective.megaphone (see mailinglist-discussion)
The goal for this package is:
- to make SQL storage from PloneFormGen easy
- to also work with collective.megaphone
To install a complete development setup:
svn co https://svn.plone.org/svn/collective/Products.PloneFormGen/adapters/Products.sqlpfgadapter/buildout/plone3 sqlpfg-plone3 cd sqlpfg-plone3 python2.4 bootstrap.py ./bin/buildout -c buildout-dvl.cfg
If you use another buildout configuration, see dependencies below.
After running buildout, collective.recipe.plonesite should have created a Plone site with id ‘Plone’, and with PloneFormGen, plone.app.registry and this product installed.
As a site admin, go to the “SQL Settings” in Plone’s control panel. You’ll be taken to “@@sqlpfg-controlpanel”. Here you can set your database connection settings.
To save a form’s data in the database, add a “MySQL Adapter” from the “Add new…” menu in the Form Folder. Give it a title and save it.
A database table will be created. Its name is generated (from the Form Folder’s id, among others), you can see it by viewing the adapter object. The table has an ‘id’ column, and a column for each form field.
That’s it! From now on, succesfully submitted forms will be stored in the database.
Usage with collective.megaphone
Not implemented yet.
This product is under development. For now, we have major limitations:
- Not all PloneFormGen fields work, notably:
- file field
- decimal field
- rating-scale field
- Adding and removing fields, or changing their names, doesn’t change the database table. Field names for which there is no column will just be discarded.
- Test collective.megaphone compatibility
- Support all form field types.
- Test Plone 4 compatibility;
- Allow updating tables when fields are added;
Compatibility / Dependencies
Tested on Plone 3.3.5 with collective.lead 1.0, SQLAlchemy 0.4.8, MySQL 5.1.41
This product uses plone.app.registry for its controlpanel. In order for it to work, add this to your buildout:
[buildout] extends += http://good-py.appspot.com/release/plone.app.registry/1.0b2?plone=3.3.5 [versions] z3c.form = 1.9.0
- Initial release
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size Products.sqlpfgadapter-0.1a1.tar.gz (19.5 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for Products.sqlpfgadapter-0.1a1.tar.gz