and why should you need it ?
you can always do:
newthing = {}
if something:
newthing = form.vars
dowhatever with newthing (it's an empty dict that in theory shouldn't hurt)
On Wednesday, December 5, 2012 1:49:00 AM UTC+1, Daniele wrote:
How can I blank out all the **form.vars in the
OK. So I removed what I had before (tables in a database) and moved to
SQLFORM.factory. I now have this in my controller:
form = SQLFORM.factory(
Field('is_tutor', 'boolean'),
Field('image', 'upload',
requires=IS_EMPTY_OR(IS_IMAGE(extensions=('jpeg', 'jpg', 'png', 'gif',
if form.process().accepted:
if form.vars.is_tutor:
...whatever, e.g. db.table.insert(**form.vars)
How do you structure your db to save this data is up to your application:
if you need this stored next to the auth_user table the recommended way is
extending auth_user with
Thanks that was super helpful!
On Tuesday, December 4, 2012 4:31:08 PM UTC, Niphlod wrote:
if form.process().accepted:
if form.vars.is_tutor:
...whatever, e.g. db.table.insert(**form.vars)
How do you structure your db to save this data is up to your application:
if you
Another question has come to mind...I have the following code in my
controller now:
if tform.process().accepted:
if tform.vars.is_tutor:
auth.add_membership('Tutors')
db.auth_user.insert(
a_bunch_of_fields = tform.vars.a_bunch_of_fields)
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
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
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 niph...@gmail.com wrote:
depends on where do you use that kind of logic.
There's some problem with what I'm doing now.
I have form = SQLFORM.factory() with all the fields in my controller.
In my db.py file, I am extending auth with
auth.settings.extra_fields['auth_user']= [
Field http://127.0.0.1:8000/examples/global/vars/Field('t_image'),
Field
if it's checked the corresponding var would be True.
If the form is submitted the controller will receive that field as
request.vars.fieldname or as form.vars.fieldname if you are using a form.
When you get to the form.process() line the value has been already been
shipped to the database. You
10 matches
Mail list logo