Because I want to add other field to the form so I use SQLFORM.factory. And this is my __copydata method def __copydata(src, dest, fields): if src: for k in fields: if src.has_key(k): dest[k] = src[k] return dict()
Anthony於 2016年2月26日星期五 UTC+8下午9時08分13秒寫道: > > > for t in db.project: >> query = (t.id == request.vars.id) >> __copydata(db(query).select(limitby=(0,1)).first(), form.vars, >> t.fields) >> > > The above is confusing and cannot be the actual code, as it would raise an > exception. When you iterate over db.project, you get its Field objects (so > each value of "t" is a Field object). Field objects do not have ".id" or > ".fields" attributes, so both of the next two lines would result in errors. > Perhaps you instead mean to be iterating over Table objects, but it's not > clear why you would be doing that, as the form is based on just a single > table. > > Anthony > -- 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.