Yarko, from a post I yesterday that nobody responded to....

I am wanting a form to display Studies that use Rooms. Many studies can be
ran in a room, and a room can belong to many studies.

How would you go about using SQLFORM on a database object that has a many to
many relationship.

Using the model below, provides a checkbox for rooms, which is exactly how I
want it to work.

My current model displays correctly, however it errors on submit.

"""
Table definition
"""
db.define_table("room",
      Field("name", "string"),
      Field("size", "integer"))

"""
Table definition

db.table.field.requires=IS_IN_DB(db,'othertable.id
','%(otherfield)',multiple=True)
"""
db.define_table("study",
      Field("number", "string"),
      Field("rooms", db.room, requires=IS_IN_DB(db, 'room.id', 'room.name',
multiple=True)),
      )

TypeError: int() argument must be a string or a number, not 'list'


-Thadeus




On Thu, Sep 17, 2009 at 12:12 PM, Jason Brower <encomp...@gmail.com> wrote:

>
> It's ok, I think I got it.
> Sorry about that.
> Jason
>
> On Thu, 2009-09-17 at 12:02 -0500, Yarko Tymciurak wrote:
> > "...problem with many-to-many in form..."  by itself doesn't tell what
> > problem you think you are having...  a more detailed description of
> > what you want & how you're trying to accomplish it may help...
> >
> > On 9/17/09, Thadeus Burgess <thadeus.burg...@gmail.com> wrote:
> > > Yes I am having a problem with the many-to-many relationship in a form
> as
> > > well.
> > >
> > > I would love to know how to solve this.!
> > >
> > > -Thadeus
> > >
> > >
> > >
> > >
> > > On Thu, Sep 17, 2009 at 7:17 AM, encompass <encomp...@gmail.com>
> wrote:
> > >
> > >> CT kind of works.  It give the drop downlist.  But there
> > >> is no content in it.  How do I populate it with the solution.name but
> > >> it uses the ID in the database?
> > >>
> > >
> > > >
> > >
> >
> > >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to