Chapter 16.6. Creating Custom Widgets

We’ve already seen how the creators of the WhatWhat Status project used custom widgets to display and dynamically create editable forms for Project data. You may want to go back and take another look at Chapter 7, “Controllers, Views, and JavaScript in the WhatWhat Status,” to go over those widgets in light of your new insight into how widgets work.

Rather than go over that same ground again in this chapter, we’re going to look at how two very different widgets work.

First, let’s take a look at how TableForm works to render errors, and form fields on the page, and how we could customize the TableForm widget.

Here’s the original TableForm widget code.

class TableForm(Form): template = """ <form ...

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.