Not sure, but SQLFORM.smartgrid don't do what you want?

Richard

On Tue, May 15, 2012 at 4:43 AM, Alec Taylor <alec.tayl...@gmail.com> wrote:

> Thanks Annet, that's what I currently have, but it doesn't allow for
> CRUD of anything but the outer table, it won't allow for CRUD of any
> of the inner tables.
>
> I would like—either in the drop down or as an "Add/modify" link next
> to it—the ability to CRUD entries in that referenced table.
>
> If there is an abstracted way of doing it, I would prefer that method
> rather than doing it manually, i.e.: inserting a link using
> form.element, then using the lazy_options_widget to update that field
> in the form
>
> So, is there one?
>
> On Tue, May 15, 2012 at 2:50 PM, Annet <anneve...@googlemail.com> wrote:
> >> So if I could generate one form that allows you to create a customer,
> >> complete with address, the management would become much more logical.
> >
> > In this case I'd use SQLFORM.factory:
> >
> > def create():
> >     form=SQLFORM.factory(db.customer,db.address)
> >     if form.process().accepted:
> >         id = db.customer.insert(**db.customer._filter_fields(form.vars))
> >         form.vars.customer=id
> >         id = db.address.insert(**db.address._filter_fields(form.vars))
> >     return dict(form=form)
> >
> > See the book:
> >
> http://www.web2py.com/books/default/chapter/29/7?search=insert%28**#One-form-for-multiple-tables
> >
> >
> > Regards Annet.
>

Reply via email to