Does it work with crud as well?
Thanksd
On Monday, 12 October 2009 06:37:31 UTC+5, mdipierro wrote:
>
> Something is wrong with this:
>
> db.define_table('dogs',
> ...
> Field('vaccination_id', db.vaccinations))
>
> db.define_table('vaccinations',
> Field('dog_id', db.dogs),
> ...
> )
> there is a circular definition and seems to indicate each dog can have
> a single vaccination.
>
> I would go with this:
>
> db.define_table(
> 'users'
> Field('name')
> )
>
> db.define_table(
> 'dogs',
> Field('owner_id', db.users),
> Field('name'),
> )
>
> db.define_table(
> 'vaccinations',
> Field('dog_id'),
> Field('vaccination')
> )
>
> You can do things like:
>
> form=SQLFORM.factory(db.dogs,db.vaccinations)
>
> but you have to be careful about repeated fields.
>
> If you describe the workflow of what you need to do perhaps we can
> help more.
>
> Massimo
>
>
> On Oct 11, 6:47 pm, Peter Woolf <[email protected]> wrote:
> > Can I create a crud form that simultaneously update multiple rows and
> > multiple tables? I’ve been through the web2py manual a number of
> > times, but don’t see this issue addressed. Below is an example:
> >
> > In db.py
> >
> > db.define_table(
> > 'users'
> > Field('name')
> > )
> >
> > db.define_table(
> > 'dogs',
> > Field('owner_id', db.users),
> > Field('name'),
> > Field('vaccination_id', db.vaccinations)
> > )
> >
> > db.define_table(
> > 'vaccinations',
> > Field('dog_id', db.dogs),
> > Field('vaccination')
> > )
> >
> > Given these three tables, I want to be create a crud form where I can
> > update the names and vaccinations of all of the dogs of a particular
> > owner. For example, if I have two dogs, muffy and fluffy, then I want
> > to create a form where both the records of muffy AND fluffy are
> > presented in ONE form to allow me to edit the tables ‘dogs” and
> > ‘vaccinations’ with one submit button.
> >
> > Any thoughts on how to do this? I can easily make a crud form for a
> > single record, but this would mean I have many submit buttons on a
> > page or a very long series of pages to do something simpler.
> >
> > Any thoughts would be appreciated.
> >
> > Thanks,
> > --Peter
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.