[web2py] Re: customizing SQLFORM to insert many rows from one form
you can try this http://www.mdelrosso.com/sheepit/index.php?lng=en_GB On Monday, April 2, 2018 at 5:37:09 PM UTC+3, Mashareq M wrote: > > Hi, > > I am creating a web app for attending employees. > > This is the model: > > db.define_table( > 'employee', > Field('name'), > format = '%(name)s') > db.define_table( > 'attendance', > Field('employee_id',db.employee), > Field('attend','boolean'), > Field('comments','text') ) > > This is the controller: > def fillForm(): > employeeIDS=db(db.employee).select(db.employee.ALL) > form = SQLFORM(db.attendance) > if form.process(session=None, formname='test').accepted: > response.flash = 'form accepted' > elif form.errors: > response.flash = 'form has errors' > else: > response.flash = 'please fill the form' > return locals() > > This is the view: > > > > name > attend? > comments > > > {{for eid in employeeIDS:}} > > {{=eid.name}} > > > > > {{pass}} > > > > > > > The question is: > > How can I insert the data in each row in the table to be in one row in the > attendance table, whether the employee is attendance or absence ? > > > Best Regards, > -- 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.
[web2py] Re: customizing SQLFORM to insert many rows from one form
See https://stackoverflow.com/a/49613367/440323. On Monday, April 2, 2018 at 10:37:09 AM UTC-4, Mashareq M wrote: > > Hi, > > I am creating a web app for attending employees. > > This is the model: > > db.define_table( > 'employee', > Field('name'), > format = '%(name)s') > db.define_table( > 'attendance', > Field('employee_id',db.employee), > Field('attend','boolean'), > Field('comments','text') ) > > This is the controller: > def fillForm(): > employeeIDS=db(db.employee).select(db.employee.ALL) > form = SQLFORM(db.attendance) > if form.process(session=None, formname='test').accepted: > response.flash = 'form accepted' > elif form.errors: > response.flash = 'form has errors' > else: > response.flash = 'please fill the form' > return locals() > > This is the view: > > > > name > attend? > comments > > > {{for eid in employeeIDS:}} > > {{=eid.name}} > > > > > {{pass}} > > > > > > > The question is: > > How can I insert the data in each row in the table to be in one row in the > attendance table, whether the employee is attendance or absence ? > > > Best Regards, > -- 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.