Ticket #326 (closed enhancement: fixed)
|Reported by:||KarlGuertin||Owned by:||Karl Guertin <grayrest@…>|
The main reason I had to implement declarative style forms (#114) was to make compound widgets straightforward to declare.
The purpose of compound widgets is to enable SQLObject joins to be shown on the same page. If, for example we have the following SQLObject class setup (taken from the SQLObject documentation:
class Person(SQLObject): firstName = StringCol() middleInitial = StringCol(length=1, default=None) lastName = StringCol() addresses = MultipleJoin('Address') class Address(SQLObject): street = StringCol() city = StringCol() state = StringCol(length=2) zip = StringCol(length=9) person = ForeignKey('Person')
And we want to display the person on a single page including all his addresses. This is not doable under the current widgets system (or if it is I missed it). It is possible, however, if you have containers:
class AddressForm(W.ListContainer): street = TextField(labeltext="Street Address") city = TextField() state = TextField(validator=V.StateProvince()) zip = StringCol(validator=V.PostalCode()) class PersonForm(W.ListForm): firstName = TextField(labeltext="First Name") middleInitial = TextField(labeltext="Middle Initial") lastName = TextField(labeltext="Last Name") addresses = AddressForm()
And and the form will come out with all addresses (this example uses the syntax for the preview patch attached and depends on the ListForm? path that's currently pending). Presumably the same thing could be accomplished using a datacontroller and work automagically.
- Status changed from new to assigned
- Milestone changed from 0.9 to 1.0
- Status changed from assigned to new
- Owner changed from anonymous to Karl Guertin <grayrest@…>