This is a database error, not a web2py. I suggest you print print db((db.feed.account_id.belongs(thelist))& (db.accounts.id==db.feed.account_id))._select (db.feed.ALL,db.accounts.name, accounts2.id, accounts2.name, left=accounts2.on(rows), orderby=~db.feed.id, limitby=(0, 10))
and try to execute the query from mysql> Massimo On May 2, 6:21 pm, TheDude <[email protected]> wrote: > OperationalError: (1054, "Unknown column 'feed.to_player' in 'on > clause'") > > mysql> show fields from feed; > +--------------+----------+------+-----+---------+----------------+ > | Field | Type | Null | Key | Default | Extra | > +--------------+----------+------+-----+---------+----------------+ > | id | int(11) | NO | PRI | NULL | auto_increment | > | account_id | int(11) | YES | MUL | NULL | | > | date_created | datetime | YES | | NULL | | > | to_player | int(11) | YES | MUL | NULL | | > | message | longtext | YES | | NULL | | > +--------------+----------+------+-----+---------+----------------+ > > The app > > @character_required() > > def index(): > friends = db(db.friends.account_id==session.account.id).select > (db.friends.friend) > thelist = [] > for f in friends: > thelist.append(f['friend']) > if len(thelist) > 0: > accounts2 = db.accounts.with_alias("accounts2") > rows = (accounts2.id==db.feed.to_player) > feeds = db((db.feed.account_id.belongs(thelist))& > (db.accounts.id==db.feed.account_id)).select(db.feed.ALL, > db.accounts.name, accounts2.id, accounts2.name, left=accounts2.on > (rows), orderby=~db.feed.id, limitby=(0, 10)) > try: > accounts2 = db.accounts.with_alias("accounts2") > rows = (accounts2.id==db.feed.to_player) > feeds = db((db.feed.account_id.belongs(thelist))& > (db.accounts.id==db.feed.account_id)).select(db.feed.ALL, > db.accounts.name, accounts2.id, accounts2.name, left=accounts2.on > (rows), orderby=~db.feed.id, limitby=(0, 10)) > except: > feeds = None > else: > thelist = None > feeds = None > return dict(feed=feeds) > > def logout(): > if session.has_key('account'): > del session.account > session.flash = "Logged out of your character" > > return redirect(URL(r=request, c='account', f='index', args='')) > > def show(): > return dict(message="Test") --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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 -~----------~----~----~----~------~----~------~--~---

