@auth.requires_login()
def keepalive():
    import time
    db(db.online.id>0).delete() #evtl. weglassen
    if auth.user.id:
        if db(db.online.user_id==auth.user.id).count()==0:
 
db.online.insert(user_id=auth.user.id,last_visit=time.time())
        else:
 
db(db.online.user_id==auth.user.id).update(last_visit=time.time())
    dt = 5000
    usersall=db(db.online.last_visit>time.time()-dt)
(db.online.user_id==db.auth_user.id).select(db.auth_user.ALL)
    return TABLE(*[TD(user.user_name) for user in usersall])


but what i need is not the auth.user which are online, i need the user
from another table for example friends.

On 4 Jan., 21:04, Richard Vézina <ml.richard.vez...@gmail.com> wrote:
> Ok and how do you fill up this table?
>
> By the way SQLField is deprecated... Use Field() instead.
>
> Richard
>
>
>
>
>
>
>
> On Tue, Jan 4, 2011 at 2:43 PM, pk <peter.kirch...@youngdesigners.de> wrote:
> > #########################################################################
> > ## Tabelle Onlineuser
> > #########################################################################
> > db.define_table('online',
> >                SQLField('user_id',db.auth_user),
> >                SQLField('last_visit','integer'))
>
> > On 4 Jan., 16:40, Richard Vézina <ml.richard.vez...@gmail.com> wrote:
> > > The model are missing for db.online
>
> > > Richard
>
> > > On Mon, Jan 3, 2011 at 5:13 PM, pk <peter.kirch...@youngdesigners.de>
> > wrote:
> > > > hi together,
>
> > > > i have a function for the onlineuser:
>
> > > > usersall=db(db.online.last_visit>time.time()-dt)
> > > > (db.online.user_id==db.auth_user.id).select(db.auth_user.ALL)
> > > > return TABLE(*[TD(user.user_name) for user in usersall])
>
> > > > but i will to get all the onlineuser which are friends of mine.
> > > > here is my friendsdatabasetable:
>
> > #########################################################################
> > > > ## Tabelle Freunde
>
> > #########################################################################
> > > > db.define_table('friends',
> > > >                SQLField('userid',
> > > >                         default=auth.user.id if auth.user else 0,
> > > >                         writable=False, readable=False),
> > > >                SQLField('hauptperson',
> > > >                         default=auth.user.user_name if auth.user else
> > > > 0,
> > > >                         writable=False, readable=False,
> > > > label='Hauptperson'),
> > > >                SQLField('freund', label='Freund'),
> > > >                SQLField('freundseit', 'datetime',
> > > > default=request.now, label='Freund seit'),
> > > >                SQLField('bestaetigt','boolean', default=False))
>
> > > > db.friends.userid.requires=IS_IN_DB(db,'auth_user.id')
> > > > db.friends.hauptperson.requires=IS_IN_DB(db,'auth_user.user_name')
> > > > db.friends.freund.requires=IS_IN_DB(db,'auth_user.user_name')
>
> > > > how can i get this list and how can i do the name clickable???
>
> > > > thanks for your help
>
> > > > peter

Reply via email to