DBcherry
Introduction
This page illustrates the functionality of DBcherry and provides various code snippets. More extensive information is available as well. At the moment this is very much a work in progress, so some links might not work (yet).
DBcherry Basics
Once you have created one or more classes that derive from DBobject and DBcherry, all functionality is accessible once you start Cherrypy. (Here's an example ).
Functions
Browsing all Items
The startpage of your CherryPy application
shows a list of all items in root class.
Similar list for other classes are accessible
via the menubar at the top.
You can scroll forward or backward by
clicking Previous or Next.
To add a new item click Add.
It is also possible to delete or edit a
specific item from the list by clicking
the appropriate button in the first column.
Clicking on an item in the second column
gives a full view of that item. The last
column(s) show(s) attributes from items
that are related. Clicking them gives a
full view of that item.
Clicking on an item in the second column gives a full view of that item. The last column(s) show(s) attributes from items that are related. Clicking them gives a full view of that item.
Viewing a single item
Clicking on the 2nd column in the overview gives a full view
of the item.
The full view not only shows all attributes of an item but also gives access to the add, edit and delete windows.
Searching
Each overview has a
Search
button. This button gives access to a
dialog where search criteria can be entered.
Adding an item
Both the overview window and the view
window provide an
Add
button.
If the
Add
button is clicked,
the user is presented a simple dialog
with a fill-in field for every attribute.
Depending on the
data type
this field may have additional utility
buttons, like a calendar for dates or
a file browse button for uploading
pictures.
Editing an item
Both the overview and the view windows provide an Edit button. If the Edit button is clicked, the user is presented a simple dialog with a fill-in field for every attribute.
The fields have the current value of the
attributes filled in.
Depending on the
data type
these fields may have additional utility
buttons, like a calendar for dates or
a file browse button for uploading
pictures.
Deleting an item
Both the overview window and the view
window provide an
Delete
button.
If the
Delete
button is clicked,
the user is presented a dialog asking
for confirmation.
If an item has associated items, these
associations are deleted as well, but
not
the associated items themselves.
Linking items
Unlinking items
Data types
The aim of DBcherry is to support all MySQL datatypes in a way that is transparent to the user. However, to aid in adding or editing a value, some datatypes receive special attention.
Text and Numbers
Text and numbers are not (yet) treated in any special way.
Dates
Dates are displayed as YYYY-MM-DD and should be entered that way as well. To make it easier for users to enter dates in the add- and editwindows, date fields are provided with a calendar widget.
Blobs/Images
Presently all blobs are treated as images. They are presented as thumbnails in the overview window and full size in the view window. In the add and edit windows the button.
Enumerated lists
Changing Behaviour & Appearance
Although DBcherry is designed to provide all functionalidy out-of-the-box, quite a few characteristics can be customized.
Hiding and Showing Columns
Any column that shouldn't be displayed in the overview window should be added to the class variable invisible . Colums marked as invisible are shown in the view window.
class Item(DBobject,DBcherry):
cols=dict(cola='text',colb='text')
invisible=['colb']
Changing the Order of Columns
By default the order in which colums are displayed is random. This may be influenced however by adding to the class variable colseq . Any column not in colseq is displayed followiny the ones in colseq but in an unspecified order.
class Item(DBobject,DBcherry):
cols=dict(cola='text',colb='text')
colseq=['colb','cola']
Sorting
By default items in the overview window are not sorted. This can be changed by specifying a sort order in the class variable order .
class Item(DBobject,DBcherry):
cols=dict(cola='text',colb='text')
order=dict(colb='asc')
CSS Stylesheet
Almost every aspect of the user interface can be changed via a css stylesheet. By default the application uses the file static/style.css . This file is provided in the distribution and may be used as an example.