On 3/27/06, Mike Kent <[EMAIL PROTECTED]> wrote:
>
> Given the following simple model:
>
> class Article(SQLObject):
> author = ForeignKey('TG_User')
> published = BoolCol(notNone=True, default='t', title="Pub Flag")
> created = DateTimeCol(default=datetime.now())
> modified = DateTimeCol(default=datetime.now())
> category = StringCol(length=20, default='')
> title = StringCol(notNone=True, length=40)
> text = StringCol(notNone=True)
>
> and with Identity and Visit turned on, then when I bring up the 'add'
> form via the DataController, how can I get it to handle the author
> field correctly? I need some way to pick an author from one of the
> users in the TG_User table, so that the user id is put into the author
> field.
I assume from your message that it doesn't just handle it correctly
out of the box?
You *can* add arbitrary rules to formmaker for choosing and setting up widgets:
from turbogears.fastdata import formmaker
@formmaker.column_widget.when("some condition")
def user_widget(column):
...setup widget as desired...
return widget
There *is* a rule for foreign keys already.
Kevin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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-trunk
-~----------~----~----~----~------~----~------~--~---