Sorry, left some cruff in from before.
It should have belongs==(...) it should just be belongs(...)
i.e.
postcodelist=[]
closepostcodes=ukpostcodes.closest_postcodes(session.postcode,
str(session.distance))
for p in closepostcodes:
postcodelist.append(p[1])
rows = db(db.data.postcode.belongs(p for p in
postcodelist)).select(db.data.download, db.data.postcode,
db.data.lat, db.data.lon,
db.providers.name,
left=db.providers.on(db.data.provider==db.providers.id),
orderby=~db.data.download)
return dict(table=rows, message=postcodelist)
On Sat, Oct 8, 2011 at 3:53 PM, Chris Rowson
<[email protected]> wrote:
> I finally used...
>
> postcodelist=[]
> closepostcodes=ukpostcodes.closest_postcodes(session.postcode,
> str(session.distance))
> for p in closepostcodes:
> postcodelist.append(p[1])
> rows = db(db.data.postcode.belongs==(p for p in
> postcodelist)).select(db.data.download, db.data.postcode,
> db.data.lat, db.data.lon,
> db.providers.name,
>
> left=db.providers.on(db.data.provider==db.providers.id),
> orderby=~db.data.download)
>
> Seems to work!
>
> Thanks for the advice about the range generator. I'm still learning
> all this stuff :-D
>
> Chris
>
> On Sun, Oct 2, 2011 at 7:38 AM, Chris Rowson
> <[email protected]> wrote:
>> Thanks Peter, I'll give that a try.
>>
>> Chris
>>
>> On Sep 30, 2011 8:01 PM, "Peter Etchells" <[email protected]>
>> wrote:
>>> results=db(db.data.belongs([p[1] for p in postcodes).select()
>>
>