>> That example doesn't look like a true many-to-many it looks like a
>> one-to-many. Because in the example it searches for both id's already being
>> in the many-to-many table and if they are it only updates. Where as a true
>> many to many you would have multiple entries IE: (1, 1, 20), (1, 1, 40),
>> (1, 1, 50) etc....

Not so.  One buyer can purchase many products and one product can have
many purchases.  That makes it many-to-many.

While it's true that example 33 allows only one relationship between
one buyer and one product,
that does not disqualify it from being a many to many relationship.

If the example were designed to allow multiple purchases between one
single buyer and one single product, it would check the id of the
linking record before making the insert/update decision.   If the id
of the linking record is absent, then do an insert.  Otherwise an
update.

Maybe it's just my personal paranoia about connection reliability,
etc. but I much prefer smartgrid's approach to what Django does.
Getting the primary table's record in the db is much more important,
from my perspective, than the seeming convenience of having it all on
one screen.

On Dec 25, 1:01 pm, Bruce Wade <bruce.w...@gmail.com> wrote:
> That example doesn't look like a true many-to-many it looks like a
> one-to-many. Because in the example it searches for both id's already being
> in the many-to-many table and if they are it only updates. Where as a true
> many to many you would have multiple entries IE: (1, 1, 20), (1, 1, 40),
> (1, 1, 50) etc....
>
> See the attached of how django handles it and what I want to see how to
> bend web2py database admin to handle automatically as well.
>
> The multiple select box's are many-to-many built into a single parent form.
> You can also click the plus symbol to add new items in the select box if
> they do not already exist. We should never have to manual select the parent
> ID if it is already in the same form.
>
> On Sun, Dec 25, 2011 at 8:29 AM, Christopher Steel 
> <chris.st...@gmail.com>wrote:
>
> > OK, If your database table is setup correctly then in the database
> > examples section you should be able to create a form similar to the one in
> > example 33 for a many to many relationship.
> >http://web2py.com/examples/database_examples/buy
>
> > (http://web2py.com/examples/default/examples#database_examplessee
> > number 33 )
>
> --
> --
> Regards,
> Bruce 
> Wadehttp://ca.linkedin.com/in/brucelwadehttp://www.wadecybertech.comhttp://www.warplydesigned.comhttp://www.fitnessfriendsfinder.com
>
>  many_to_many.png
> 159KViewDownload

Reply via email to