In SQLFORM.factory's Field field:
Field( 'user_id', db.auth_user,
label = 'Felhasználó e-mail',
requires = IS_NULL_OR( IS_IN_DB( db, db.auth_user.id, '%
(first_name)s' ) ) ),
But works in 1.79.2 and seems to work if I use 'integer' and not
db.auth_user
I have
db.define_table( 'auth_user',
Field( 'id', 'id',
represent = lambda id:SPAN( id, ' ', A( 'view', _href =
URL( 'auth_user_read', args = id ) ) ) ),
Field( 'username', type = 'string',
label = T( 'Username' ) ),
Field( 'first_name', type = 'string',
label = T( 'First Name' ) ),
Field( 'last_name', type = 'string',
label = T( 'Last Name' ) ),
Field( 'email', type = 'string',
label = T( 'Email' ) ),
Field( 'password', type = 'password',
readable = False,
label = T( 'Password' ) ),
Field( 'created_on', 'datetime', default = request.now,
label = T( 'Created On' ), writable = False, readable =
False ),
Field( 'modified_on', 'datetime', default = request.now,
label = T( 'Modified On' ), writable = False, readable =
False,
update = request.now ),
Field( 'registration_key', default = '',
writable = False, readable = False ),
Field( 'reset_password_key', default = '',
writable = False, readable = False ),
Field( 'registration_id', default = '',
writable = False, readable = False ),
format = '%(username)s',
migrate = settings.migrate )
auth.define_tables( migrate = settings.migrate )
Traceback:
Traceback (most recent call last):
File "/home/szimszon_nfs/web2py/gluon/restricted.py", line 188, in
restricted
exec ccode in environment
File "/home/szimszon_nfs/web2py/applications/reboot/controllers/
default.py", line 113, in <module>
File "/home/szimszon_nfs/web2py/gluon/globals.py", line 95, in
<lambda>
self._caller = lambda f: f()
File "/home/szimszon_nfs/web2py/gluon/tools.py", line 2292, in f
return action(*a, **b)
File "/home/szimszon_nfs/web2py/applications/reboot/controllers/
default.py", line 90, in logok
label = 'Leírás', ),
File "/home/szimszon_nfs/web2py/gluon/sqlhtml.py", line 1182, in
factory
return SQLFORM(SQLDB(None).define_table(table_name, *fields),
File "/home/szimszon_nfs/web2py/gluon/dal.py", line 3314, in
define_table
t._create_references()
File "/home/szimszon_nfs/web2py/gluon/dal.py", line 3607, in
_create_references
rtable = self._db[rtablename]
File "/home/szimszon_nfs/web2py/gluon/dal.py", line 3335, in
__getitem__
return dict.__getitem__(self, str(key))
KeyError: 'auth_user'
<type 'exceptions.KeyError'>('auth_user')
builtinstr <type 'str'>
self <DAL {'_lastsql': '', '_db_codec': 'UTF-8', 'no_..._uri': None,
'_migrate': False, '_pool_size': 0}>
dict.__getitem__ <method '__getitem__' of 'dict' objects>
builtindict <type 'dict'>
key 'auth_user'
def __iter__(self):
for tablename in self.tables:
yield self[tablename]
def __getitem__(self, key):
return dict.__getitem__(self, str(key))
def __setitem__(self, key, value):
dict.__setitem__(self, str(key), value)