Is there any reason you couldn't use something like this in your Enterprise
form template?

<a href="${tg.url('/contacts/new/" + str(enterprise.id))}">New Contact</a>

Then, in your new contact form, you snag that id, and display whatever you
wish to display.

2011/3/15 César Fernández <[email protected]>

> Hi everybody, i'm trying to create new entities in my app from a list
> of entities related to one of them. I mean, i have one enterprise
> selected and i'm listing all of its stuff in a list. This is part of
> my model:
>
> class Enterprise(DeclarativeBase):
>        __tablename__ = 'enterprise'
>        id = Column(Integer, primary_key=True)
>        name = Column(Unicode, nullable=False)
>        [...]
>        contacts = relationship('Contact', backref='Enterprise')
>        connection = relationship('Conection', backref='Enterprise')
> [...]
>
> One enterprise have one or more contacts and (internet) connections.
> So in an html list i want a link to call a method where i can create
> one contact related to that enterprise i'm seeing. My idea would be to
> create a link to a method where i can guess the id of the enterprise
> and create a contact related to that id without selecting the
> enpterprise from a singleselectfield.
>
> Until now i create a link this way, in the template:
>
> <th><a href="${tg.url('/enterprise/new/' + str(enterprise.id))}">Edit</
> a></th>
>
> So, in the controller i can see the id (kw['id']) of the enterprise
> and edit that, but now i want to tell the method that i have that
> enterprise and i want to create a contact related to that enterprise.
> Any idea?
>
> I don't know how to search for this info in the documentation. I'm
> using toscawidget and turbogears 2.1. If anybody want to see more code
> i can post it.
>
> Thanks in advance.
>
> --
> 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.
>
>


-- 
Michael J. Pedersen
My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/pedermj022171
          Yahoo/pedermj2002, MSN/[email protected]

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