Chapter 16.3. Compound Widgets

The form widget is made up of references to other widgets, and it’s the most common case for one widget containing another, but there are lots of other cases where one widget contains another. We’ve already seen that the WhatWhat Status project has a NotesWidget that displays all the notes for a particular project, by calling the note_widget to display each individual project note.

So, rather than keeping all of the logic for maintaining Compound Widgets in the Form itself, the TurboGears widgets package maintains an abstract base class for Compound Widgets.

Having a CompoundWidget base class means that you can create your own Compound Widgets through subclassing. Here’s the NotesWidget from the WhatWhat Status ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.