[web2py] Re: How to query many to many with three fields?

2013-08-27 Thread Apple Mason
Yup, that did it. Many thanks, Alex! On Tuesday, August 27, 2013 5:34:03 PM UTC-4, Alex wrote: > > my mistake, the alias should be for table location. > > location_one = db.location.with_alias('location_one') > location_two = db.location.with_alias('location_two') > > > I hope this works. > > Am D

[web2py] Re: How to query many to many with three fields?

2013-08-27 Thread Alex
my mistake, the alias should be for table location. location_one = db.location.with_alias('location_one') location_two = db.location.with_alias('location_two') I hope this works. Am Dienstag, 27. August 2013 21:51:56 UTC+2 schrieb Apple Mason: > > Hey Alex, > > Thanks for the suggestion. The p

[web2py] Re: How to query many to many with three fields?

2013-08-27 Thread Apple Mason
Hey Alex, Thanks for the suggestion. The problem with the query is that 'location_one.geom.st_equals(point_x_y)' won't work. That's because the table db.item_location doesn't have a field called 'geom'. This is the error: AttributeError: 'Table' object has no attribute 'geom' Is there a way

[web2py] Re: How to query many to many with three fields?

2013-08-27 Thread Alex
try something like this: location_one = db.item_location.with_alias('location_one') location_two = db.item_location.with_alias('location_two') rows = db((db.item_location.item == db.item.id) & (db.item.id != itemid) & ( db.item_location.location_one == location_one.id) & (db.item_location.locati