You can use the following syntax:

db[mytable][myfield]

However, you should think about whether you really want to create a new 
table for every user. Instead, maybe look into the multi-tenancy 
<http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Common-fields-and-multi-tenancy>
 
and common filter 
<http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Common-filters>
 
functionality.

Anthony

On Wednesday, May 25, 2016 at 10:28:39 PM UTC-4, botasserv...@gmail.com 
wrote:
>
> Hello,
>
> I have a problem:
>
> #@auth.requires_login()
> def new_acc():
>     if auth.user_id == None:
>         new_acc="You need to authorize"
>     else:
>         try:
>             TestDB.define_table(auth.user.username, Field('trv_username', 
> readable=True, writable=True), Field('trv_password', readable=True, 
> writable=True))
>             new_acc="Base created"
>         except:
>             new_acc = SQLFORM('TestDB.%s' % auth.user.username) # There's 
> a problem
>             if new_acc.accepts(request):
>                 TestDB.auth.user.username.insert(trv_username=request.vars
> .trv_username,trv_password=request.vars.trv_password)
>     return dict(form=new_acc)
>
> When user logges in and visiting new_acc.html, it creates table with name 
> of his 'username' (Example: username = 'foo', so table will be TestDB.foo
> ).
> When user goes on this url again I want him to get the SQLFORM(TestDB.
> username), where username should be a variable.
>
> Can anyone help me with solution of this problem? I'm learning python 
> about half a year, and about 3 days working with web2py.
>
> Thank you.
>

-- 
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/d/optout.

Reply via email to