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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---