<spy:parent title="To-do demo" /> [[! def list_new(self, api, name): if api.db.todo_lists.selectfirst_by(name=name): raise HandlerError('New list', 'a list with that description already exists') api.db.todo_lists.insert(name=name) api.db.flush() ]] (This is an self-contained example using the same database as the <a href=/demos/to-do/index.spy>to-do demo</a>.) <h2>To-do lists</h2> [[ lists = db.todo_lists.select(order_by=db.todo_lists.c.name) ]] <spy:ul data="[L.name for L in lists]" /> <h2>New list</h2> <f:form> <f:submit value="New list" handler=self.list_new />: <f:text name=name value="" /> </f:form>