[web2py] Re: using another unique column in IS_IN_DB
country.iso2 is a 'list:reference' field, right? On Apr 24, 5:40 am, niknok nikolai...@gmail.com wrote: I have the following: db.profile.citizenship.requires=IS_IN_DB(gdb,'country.iso2', '%(name)s',multiple=True,zero=None) It works fine until I try accessing the record from appadmin (I can view the table, it fails when I view a specific record), which dumps me this: Traceback (most recent call last): File /home/erwin/Projects/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/nrg/Projects/web2py/applications/bbc/controllers/appadmin.py, line 412, in module File /home/nrg/Projects/web2py/gluon/globals.py, line 124, in lambda self._caller = lambda f: f() File /home/nrg/Projects/web2py/applications/bbc/controllers/appadmin.py, line 275, in update f='download', args=request.args[:1])) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 815, in __init__ inp = self.widgets.multiple.widget(field, default) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 272, in widget return OptionsWidget.widget(field, value, **attributes) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 206, in widget options = requires[0].options() File /home/nrg/Projects/web2py/gluon/validators.py, line 430, in options self.build_set() File /home/nrg/Projects/web2py/gluon/validators.py, line 413, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/nrg/Projects/web2py/gluon/dal.py, line 3898, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'country'
[web2py] Re: using another unique column in IS_IN_DB
try 'db.country.iso2' rather than 'country.iso2' On Apr 24, 12:40 am, niknok nikolai...@gmail.com wrote: I have the following: db.profile.citizenship.requires=IS_IN_DB(gdb,'country.iso2', '%(name)s',multiple=True,zero=None) It works fine until I try accessing the record from appadmin (I can view the table, it fails when I view a specific record), which dumps me this: Traceback (most recent call last): File /home/erwin/Projects/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/nrg/Projects/web2py/applications/bbc/controllers/appadmin.py, line 412, in module File /home/nrg/Projects/web2py/gluon/globals.py, line 124, in lambda self._caller = lambda f: f() File /home/nrg/Projects/web2py/applications/bbc/controllers/appadmin.py, line 275, in update f='download', args=request.args[:1])) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 815, in __init__ inp = self.widgets.multiple.widget(field, default) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 272, in widget return OptionsWidget.widget(field, value, **attributes) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 206, in widget options = requires[0].options() File /home/nrg/Projects/web2py/gluon/validators.py, line 430, in options self.build_set() File /home/nrg/Projects/web2py/gluon/validators.py, line 413, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/nrg/Projects/web2py/gluon/dal.py, line 3898, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'country'
[web2py] Re: using another unique column in IS_IN_DB
Thanks Villas. I missed that, and it defaulted to 'string'. How do I use 'list:reference table' with another database? I tried: 'list:reference gdb.country' but that doesn't work. On Apr 25, 7:09 am, villas villa...@gmail.com wrote: country.iso2 is a 'list:reference' field, right? On Apr 24, 5:40 am, niknok nikolai...@gmail.com wrote: I have the following: db.profile.citizenship.requires=IS_IN_DB(gdb,'country.iso2', '%(name)s',multiple=True,zero=None) It works fine until I try accessing the record from appadmin (I can view the table, it fails when I view a specific record), which dumps me this: Traceback (most recent call last): File /home/erwin/Projects/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/nrg/Projects/web2py/applications/bbc/controllers/appadmin.py, line 412, in module File /home/nrg/Projects/web2py/gluon/globals.py, line 124, in lambda self._caller = lambda f: f() File /home/nrg/Projects/web2py/applications/bbc/controllers/appadmin.py, line 275, in update f='download', args=request.args[:1])) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 815, in __init__ inp = self.widgets.multiple.widget(field, default) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 272, in widget return OptionsWidget.widget(field, value, **attributes) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 206, in widget options = requires[0].options() File /home/nrg/Projects/web2py/gluon/validators.py, line 430, in options self.build_set() File /home/nrg/Projects/web2py/gluon/validators.py, line 413, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/nrg/Projects/web2py/gluon/dal.py, line 3898, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'country'
[web2py] Re: using another unique column in IS_IN_DB
You cannot. You must do list:integer On Apr 24, 7:09 pm, niknok nikolai...@gmail.com wrote: Thanks Villas. I missed that, and it defaulted to 'string'. How do I use 'list:reference table' with another database? I tried: 'list:reference gdb.country' but that doesn't work. On Apr 25, 7:09 am, villas villa...@gmail.com wrote: country.iso2 is a 'list:reference' field, right? On Apr 24, 5:40 am, niknok nikolai...@gmail.com wrote: I have the following: db.profile.citizenship.requires=IS_IN_DB(gdb,'country.iso2', '%(name)s',multiple=True,zero=None) It works fine until I try accessing the record from appadmin (I can view the table, it fails when I view a specific record), which dumps me this: Traceback (most recent call last): File /home/erwin/Projects/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/nrg/Projects/web2py/applications/bbc/controllers/appadmin.py, line 412, in module File /home/nrg/Projects/web2py/gluon/globals.py, line 124, in lambda self._caller = lambda f: f() File /home/nrg/Projects/web2py/applications/bbc/controllers/appadmin.py, line 275, in update f='download', args=request.args[:1])) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 815, in __init__ inp = self.widgets.multiple.widget(field, default) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 272, in widget return OptionsWidget.widget(field, value, **attributes) File /home/nrg/Projects/web2py/gluon/sqlhtml.py, line 206, in widget options = requires[0].options() File /home/nrg/Projects/web2py/gluon/validators.py, line 430, in options self.build_set() File /home/nrg/Projects/web2py/gluon/validators.py, line 413, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/nrg/Projects/web2py/gluon/dal.py, line 3898, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'country'