You mentioned the field was being re-bound to the same table, which does not appear to be the case below, as SQLFORM. factory creates its own dummy table. Was this causing another problem in some other context?
Anthony On Sunday, July 16, 2017 at 4:34:25 PM UTC-4, Joe Barnhart wrote: > Yes... Massimo helped me come up with a workaround for my case. > > > I am using SQLFORM.factory to create a form to edit two tables joined > together. One table is used to index entries in a bunch of other tables by a > 6-tuple. Since these are all swimming related, the tuple is (sex, upper_age, > lower_age, stroke, distance, course). This is turned into an index and used > in a bunch of other tables which all need this same information. > > > Here is the outline of the problematic method, with the fix in RED: > > > > > def edit_event(): > . . . > (dbe, dbei) = (db.event, db.event_index) > . . . > fields = [dbei[f].clone() for f in dbei.fields if f not in ['id','code']] > fields += [dbe[f].clone() for f in dbe.fields if f not in > ['id','id_meet','id_session','id_event','ord']] > rec = db(dbe.id==event_id).select(dbe.ALL, dbei.ALL, cacheable=True, > limitby=(0,1), > > join=dbei.on(dbei.id==dbe.id_event)).first() > d = dict(rec.event_index) > d.update(rec.event) > . . . > form = modal_form(SQLFORM.factory, *fields, record=d, > table_name="event_join",showid=False, > title=H4("Editing Event Settings", _class="center”)) > . . . > > > Cloning the fields before using them in SQLFORM.factory avoids the error. > > > -- Joe > > > > > On Sunday, July 16, 2017 at 10:15:18 AM UTC-7, Leonel Câmara wrote: > Joe can you show us some code? I've already fixed two bugs related to this, > one on the DAL and another in web2py, I want to make sure yours isn't a new > one. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.