Plugin dbui Documentation
Plugin dbui Documentation
Define a foreign key in the database model
db.define_table('rpmCategories',
SQLField('category', 'string', notnull=True, unique=True),
SQLField('note', 'text'))
db.define_table('rpms',
SQLField('rpm', 'string', notnull=True, unique=True),
SQLField('id_category', db.rpmCategories, notnull=True),
SQLField('note', 'text'))
db.rpms.id_category.requires = IS_IN_DB(db, 'rpmCategories.id', 'rpmCategories.category')
Define a custom label for a field in autogenerate form
Use the keyword label
in the Field
constructor.
Define a tooltip for a field in autogenerated form
Use the keyword comment
in the Field
constructor.
Associate a custom widget to a field in autogenerated form
Use the keyword widget
in the Field
constructor.
It is a string containing the xtype associate to the widget
(see the Componenet class of the extjs documentation).
Load the plugin dbui
in your application
In the default.py
controller modify the function:
def index():
return LOAD('plugin_dbui', 'index', vars=request.vars)
Redirect the plugin output to a user view
By default the plugin use the view view/plugin_dbui.html
.
It can use another one by typping the following lines in the application
model db.py
:
from gluon.tools import PluginManager
plugins = PluginManager()
plugins.dbui.page_view = 'plugin_dbui.html'
These lines have to be executed before the plugin model plugin_dbui.py
.
The file name for the model can be different than db.py
.
Keep in mind that different model are executed following alphabetic order.
Application javascript
By default the plugin run the application script default.js
located in static/plugin_dbui/scripts
Run my application javascript
If the javascript for your application is located in the directory
static/scripts
.
In your model db.py
add:
from gluon.tools import PluginManager
plugins = PluginManager()
plugins.dbui.script_path = 'static/scripts'
Therefore the javascript foo
can be executed typing
http://localhost:800/application?script=foo
Customize the application script
Customize the grid widget associate to a table.
Add your own javascript widget in the application tree.
© 2009-2010 R. Le Gac
$Id$