Re: [web2py] generate multiple form from a query

2011-12-14 Thread Richard Vézina
Hello Anthony, I am pretty near my goal... I can't find if I can replace SQLFORM.factory _formkey/value by my own hash and if so... How can I do it?? I try this without success : form = SQLFORM.factory(Field('review_records', 'boolean',

Re: [web2py] generate multiple form from a query

2011-12-14 Thread Anthony
The _formkey is generated by form.accepts (or form.process), so after calling that, you can change it via: form.formkey = 'your_hash' Anthony On Wednesday, December 14, 2011 12:18:48 PM UTC-5, Richard wrote: Hello Anthony, I am pretty near my goal... I can't find if I can replace

Re: [web2py] generate multiple form from a query

2011-12-14 Thread Anthony
Don't have time for a thorough review, but a few points... sum_of_sum = md5_hash('|'.join(str(i) for i in list_of_row_md5h)) I think you only want to hash individual records and check individual records when they are submitted (probably via an ajax submission). There's no reason to reject

Re: [web2py] generate multiple form from a query

2011-12-14 Thread Richard Vézina
Ok... Thank you so much for your precious time Anthony! Answer in the text below... On Wed, Dec 14, 2011 at 2:07 PM, Anthony abasta...@gmail.com wrote: Don't have time for a thorough review, but a few points... sum_of_sum = md5_hash('|'.join(str(i) for i in list_of_row_md5h)) I think

Re: [web2py] generate multiple form from a query

2011-12-14 Thread Richard Vézina
Here it is! Model : db.define_table('test1', Field('f1','string'), Field('f2','integer'), Field('review','boolean')) from utils import md5_hash class v_f_s(object): def hmd5(self): return md5_hash('|'.join(str(self.test1[k]) for k in db.test1.fields())) Controller: def

Re: [web2py] generate multiple form from a query

2011-12-13 Thread Richard Vézina
Thanks for the tips Anthony... Here an other test I made : def bulk_update(): rows = db((db.lotns_lot_number.id == request.args(1))\ (db.lotns_sample.lot_number_id == db.lotns_lot_number.id)\ (db[request.args(0)].sample_id == db.lotns_sample.sample_id)).select\

Re: [web2py] generate multiple form from a query

2011-12-13 Thread Anthony
What I would like to have that is not actually possible I think is a way to detect_record_change with SQLFORM.factory... Do you have any idea how I could achieve that? You could create a hash of each row and store the hash value in a hidden field. Then on form submission, hash the

Re: [web2py] generate multiple form from a query

2011-12-13 Thread Richard Vézina
Hello Anthony, Since my row come from a query may I can do something like this (pseudo code) : rows = db((db.lotns_lot_number.id == request.args(1))\ (db.lotns_sample.lot_number_id == db.lotns_lot_number.id)\ (db[request.args(0)].sample_id == db.lotns_sample.sample_id)).select\

Re: [web2py] generate multiple form from a query

2011-12-13 Thread Anthony
On Tuesday, December 13, 2011 4:33:38 PM UTC-5, Richard wrote: Hello Anthony, Since my row come from a query may I can do something like this (pseudo code) : rows = db((db.lotns_lot_number.id == request.args(1))\ (db.lotns_sample.lot_number_id == db.lotns_lot_number.id)\

[web2py] generate multiple form from a query

2011-12-12 Thread Richard
Hello, Is there a better way of doing this : def bunch_update_with_multi_form(): form0=None form1=None form3=None form4=None form5=None form6=None form7=None form8=None form9=None form10=None form11=None form12=None form13=None form14=None

Re: [web2py] generate multiple form from a query

2011-12-12 Thread Anthony
web2py creates a hidden _formname field for each form. If there are multiple forms on the page, they must each have a unique _formname. By default, SQLFORM creates a _formname based on the table name and type of form (and possibly record number), but you can generate your own name via the

Re: [web2py] generate multiple form from a query

2011-12-12 Thread Richard Vézina
Thanks Anthony... Here what I did so far... ## CONTROLLER def bunch_review_with_multi_form(): # Getting lot and test from args or vars... rows = db((db.lotns_lot_number.id == request.args(1))\ (db.lotns_sample.lot_number_id == db.lotns_lot_number.id)\

Re: [web2py] generate multiple form from a query

2011-12-12 Thread Richard Vézina
I would need a way to display my updated rows in line... I just though that I could combine SQLTABLE and for each row of my rows query I could embeded a submit button of each of my forms that I could rename review... Putting all the form fields to hidden I could then make a onvalidation process

Re: [web2py] generate multiple form from a query

2011-12-12 Thread Richard Vézina
Not as easy as I thought... :( Richard On Mon, Dec 12, 2011 at 4:21 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: I would need a way to display my updated rows in line... I just though that I could combine SQLTABLE and for each row of my rows query I could embeded a submit button

Re: [web2py] generate multiple form from a query

2011-12-12 Thread Anthony
forms = [] flag = 0 for i in rows: Python tip -- instead of the above, try: for flag, i in enumerate(rows): forms.append(SQLFORM(db[request.args(0)], i[request.args(0)].id)) It looks like your rows are actually the result of a multi-table join, so you might need