Since I had added some fields (and intend to customize it further) to
my auth_user table the code for auth_user in db.py looks like that:
from gluon.tools import *
auth=Auth(globals(),db)
db.define_table('auth_user',
SQLField('login', 'string', length=50, default=''),
SQLField('password', 'password', length=512, readable=False,
label='Password'),
SQLField('registration_key', length=512, default= '',
writable=False, readable=False),
SQLField('reset_password_key', length=512, default='',
writable=False, readable=False),
SQLField('first_name', length=128,default=''),
SQLField('last_name', length=128,default=''),
SQLField('email', length=128,default='', unique=True),
SQLField('phone', 'string', length=30, default=''),
)
On 30 Cze, 20:59, Chris S <[email protected]> wrote:
> And you've defined auth in db.py with:
>
> from gluon.tools import Auth
> auth = Auth(globals(), db)
> auth.define_tables()
>
> I've done searches on auth_user before... I think.
>
> On Jun 30, 1:44 pm, elfuego1 <[email protected]> wrote:
>
> > Unfortunatelly it doesn't.
> > I can access any other table that's available through my application
> > but I can't get any value out of auth_user table.
> > Is it somehow protected?
> > Do I need to add some extra piece of code to expose them in my
> > application in order to be able to acqiure any value out of them?
>
> > Desperate searcher.
>
> > On 30 Cze, 06:25, Chris S <[email protected]> wrote:
>
> > > I don't guess I follow. Isn't that the same as:
>
> > > def userexist(namecheck):
> > > if db(db.auth_user.username==namecheck).count() > 0:
> > > return 'yes'
> > > else:
> > > return 'no'
>
> > > So I"m saying your querry should be:
> > > query = (db.auth_user.username==username)
>
> > > Hope that helps
>
> > > On Jun 29, 5:34 pm, elfuego1 <[email protected]> wrote:
>
> > > > Hello,
>
> > > > On this page:http://web2pyslices.com/main/slices/take_slice/53Ihave
> > > > found a great pice of code which allows to check on the fly if there
> > > > is an exact value already in database.
>
> > > > Oryginal code:
>
> > > > def ajaxuserexist():
> > > > username = request.vars.values()[0]
> > > > query = db.users.name.like(username)
> > > > numres = db(query).count()
> > > > if numres > 0 :
> > > > return 'yes'
>
> > > > return 'no'
>
> > > > But when I try to implement the same solution on auth_user table for
> > > > login column it stops working:
>
> > > > query = db.auth_users.login.like(username)
>
> > > > Do you know some solution/workaround to this problem?
>
> > > > Best regards.