PigletWatcher schrieb:
> It's like:
> 
> in a one-to-many relationship model, on the creation form of child
> model, how to show up its parent model's name or ID?
> 

-- controller --

class ChildFields(WidgetList):
     parent = HiddenField(validator=Int(not_empty=True)) # or a 
ModelValidator

     child_field = TextField()


child_form = ListForm(fields=ChildFields(), action="save_or_create_child")


@expose("the_template")
@validate(validators=dict(parent=Int(not_empty=True))
def create_child(self, parent):

     return dict(parent=parent, child_form=child_form)


-- the_template --

...
${child_form.display(dict(parent=parent))}



Diez

--~--~---------~--~----~------------~-------~--~----~
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