19.2. ModelDesignerThe first tool we'll look at is the ModelDesigner. This tool is designed to help you create your SQLObject model classes. It provides a GUI interface that allows you to create new classes by filling out simple web forms. In Figure 19.2 you can see a Task class with several columns defined for it. Figure 19.2. Default Widget AttributesThe main advantages of using the ModelDesigner are:
All of that sounds so good that you might think you always want to use ModelDesigner, but there are a couple of limitations to remember when using the ModelDesigner:
With all of that said, using the ModelDesigner to rough out your schema at the beginning of the project can help you get started much more quickly. You can always move over to the old-fashioned method of defining your tables by hand whenever the limitations of ModelDesigner start feeling painful. Using ModelDesigner is pretty simple, especially if you know how SQLObject works and have created a few tables by hand. About the only thing that trips people up is the load/save interface. You can save your project with whatever name you want, but it will always show up as "Existing TurboGears Session." Once you've defined your model, you can write it out to model.py from the "Generate Code" tab (as seen in Figure 19.4). Figure 19.4. ModelDesigner "Generate Code" tab |