Hello again, and thanks for everyone's kind attention to my previous
dumb questions :)

I'm coming to TG from ASP.NET, which means I love Data Binding, and I
know Python/TG would make binding a dropdown/combo list to a dynamic
set of data really easy, but I'm struggling in figuring it out.

Assuming I have a State model defined with abbreviation and name
fields, how would I build a US states drop down list? Following the
Toolbox SingleSelectField widget example, I've experimentally tried:

states = State.select()
list = widgets.SingleSelectField(options=states)

but apparently either SQLObject isn't a list or select's result isn't
a tuple:

File "c:\python24\lib\site-packages\TurboGears-1.0.3.2-py2.4.egg
\turbogears\wi
dgets\forms.py", line 882, in _extend_options
    if (len(opts) > 0) and not isinstance(opts[0], (tuple,list)):
TypeError: len() of unsized object

I know I could iterate over states myself and build a tuple of lists,
but I'm lazy -- is there a way to tell SingleSelectField "for each
object, use these results and use this property as your value and this
property as your text"?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to