Hey guys, 

It's been a while since I used web2py and I've pretty much forgotten 
everything.  Try as I might for the last two days I can't quite figure this 
out.

I used a web2pyslice to create a main application which manages 
authentication.  I have another app referencing main to 
login/logout/register etc.  It works great.

I'm having troubles understanding SQLFORM queries. The problem I'm having 
is using SQLFORM to select records only for a specific auth.user_id.  I 
can't seem to figure out how it wants to be handled.  I get all kinds of 
error messages while trying to perform this so I will just post my code 
that works and hopefully can advise on how I would select records 
pertaining to the user that created them.



db.define_table(
            'rig',
            Field('user_id', default=auth.user_id, readable=False, 
writable=False),
            Field('name'),
            Field('ipaddress'),
            Field('port'),
            format = '%s(name)s')

@auth.requires_login()
def edit_rigs():
    form = SQLFORM.grid(db.rig,  user_signature=False)
    return dict(form=form)

This returns all entries for all users.  I only want the current logged in 
user to see his/her own records.

Thank you for any help.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to