O'Reilly logo

Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites by Gigi Sayfan, Kevin Dangoor, Mark Ramm

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3.3. Understanding SQLObject and TurboGears Models

At the core of an MVC style application is your domain model, which in TurboGears is usually connected to a relational database through SQLObject. As mentioned in Chapter 1, “Introduction to TurboGears,” SQLObject makes database rows into objects and the data they contain into attributes.

This means you can write simple commands like these:

> User(first_name="Jane", last_name="Goodall")
> users_named_jane = UserTable.selectBy(first_name="Jane")
Figure 3.2. SQLObjects are automatically stored in table rows.

For now, we’ll assume that the User class is already created. So, the first ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required