Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Authentication (web2py)添加引用其他字段的额外字段auth_user_Authentication_Web2py_Login Control - Fatal编程技术网

Authentication (web2py)添加引用其他字段的额外字段auth_user

Authentication (web2py)添加引用其他字段的额外字段auth_user,authentication,web2py,login-control,Authentication,Web2py,Login Control,我正在使用Web2py,我想在auth_用户中添加额外的字段。其中一些字段是对其他表的引用。例如: 身份验证设置.附加字段['auth\u user']=[ 字段(‘国家’、‘参考国家’)] db.define_表( “国家”, 字段('name'), 格式='%(名称)s' ) 但我收到这个问题: 无法解析身份验证用户定义中的引用国家/地区 有人能帮我吗?我该怎么办?如何将auth_用户表与另一个表链接 最好的情况是,您需要确保在创建auth表之前先创建db.define\u表 像这样:

我正在使用Web2py,我想在auth_用户中添加额外的字段。其中一些字段是对其他表的引用。例如:

身份验证设置.附加字段['auth\u user']=[ 字段(‘国家’、‘参考国家’)]

db.define_表( “国家”, 字段('name'), 格式='%(名称)s' )

但我收到这个问题: 无法解析身份验证用户定义中的引用国家/地区

有人能帮我吗?我该怎么办?如何将auth_用户表与另一个表链接


最好的情况是,您需要确保在创建auth表之前先创建db.define\u表 像这样:

  db.define_table('bank',
  Field('name'),
  format = '%(name)s')

     auth.settings.extra_fields['auth_user'] = 
      [Field('bank', 'reference bank',
      label = T('Bank'),
      notnull = True,
      required = True,
      requires = IS_IN_DB(db, db.bank.id, '%(name)s') ),
]


如果我只想添加一个引用表bank的字段(int类型),但它不是下拉列表,该怎么办。所以,每次用户注册时,他/她都会向表bank添加新记录,即使已经存在同名记录?
   auth.define_tables(username = True, signature = True)

  custom_auth_table = db[auth.settings.table_user_name]

 auth.settings.table_user = custom_auth_table