The format argument goes in the define_table() call -- is that where you have it?
Anthony On Friday, November 30, 2012 1:58:09 AM UTC-5, Luc Chase wrote: > > Thanks for the suggestion. I had tried something similar but got an error > and even with this I have an error referencing to the unexpected use of > 'format'. > > <type 'exceptions.TypeError'> __init__() got an unexpected keyword > argument 'format'VERSIONweb2py™(2, 2, 1, datetime.datetime(2012, 10, 21, > 16, 57, 4), 'stable')PythonPython 2.7: C:\Program > Files\Python\web2py_win\web2py\web2py.exeTRACEBACK > > 1. > 2. > 3. > 4. > 5. > > Traceback (most recent call last): > File "gluon/restricted.py", line 212, in restricted > File "C:/Program > Files/Python/web2py_win/web2py/applications/Timesheet/models/db_wizard.py" > <http://127.0.0.1:8000/admin/default/edit/Timesheet/models/db_wizard.py>, > line 40, in <module> > TypeError: __init__() got an unexpected keyword argument 'format' > > ERROR SNAPSHOT [image: help] > > <type 'exceptions.TypeError'>(__init__() got an unexpected keyword > argument 'format') > > On Thursday, 29 November 2012 02:08:58 UTC, Massimo Di Pierro wrote: >> >> The problem is that it cannot assign the default validator unless the >> table is defined. You can do >> >> db.define_table('t_project', >> Field('f_name', type='string', >> label=T('Name')), >> Field('f_parent_project', type='reference t_project', >> label=T('Parent Project')), >> .... >> format='%(f_name)s', >> migrate=settings.migrate) >> >> db.t_project.f_name.requires = IS_EMPTY_OR(IS_IN_DB(db,'t_project.id >> ',format=db.t_project._format)) >> >> The last line will restore the dropdown. >> >> >> On Wednesday, 28 November 2012 14:39:14 UTC-6, Jim S wrote: >>> >>> I'm seeing this as well. >>> >>> -Jim >>> >>> >>> On Tuesday, November 27, 2012 12:09:18 PM UTC-6, Luc Chase wrote: >>>> >>>> If the reference is to a different table, the CRUD form renders the >>>> field as a list box allowing the user to select the record from the >>>> foreign >>>> table. But as a self-join the CRUD form renders the field as a simple >>>> text >>>> box and it seems to create a default value of 0 when saved. Then, I think >>>> that causes the record to generate an error when viewed ( but not when >>>> edited). >>>> >>>> >>>> I can post the entire models file if that would help. >>>> >>> --