How can I blank out all the **form.vars in the event that the form.vars.is_tutor returns false? Is there a simple way to do this or should I manually put in None for all the fields?
On Tue, Dec 4, 2012 at 8:16 PM, Niphlod <[email protected]> wrote: > depends on where do you use that kind of logic. If the user is already > logged, you need to UPDATE the corresponding "auth_user" row with the data > inserted, something among the lines of > > db(db.auth_user.id == auth.user_id).update(**form.vars) > > If instead you are requesting the user to fill that form without being > logged already, you'd need to CREATE the row, so you should use > insert....in that case you should also ask for username/email and the > password. > > summary: form.vars holds a dictionary composed of fieldname --> values. > Both .insert() and .update() take a dictionary, in which case the columns > corresponding to a table are updated/created with the correct values. > > On Tuesday, December 4, 2012 8:34:31 PM UTC+1, Daniele wrote: >> >> And the same goes for db.auth_user.insert() ... does it imply the logged >> user or not? >> >> On Monday, December 3, 2012 2:27:29 PM UTC, Daniele wrote: >>> >>> Hey guys, I'm wondering if there's a way from the controller to know >>> whether a form's boolean field (checkbox) is selected or not. I only want >>> to add the info in the form to the database if the checkbox is selected, >>> otherwise the controller should not process that form. >>> >>> Thanks! >>> >> -- > > > > --

