I'm using SQLFORM.factory to generate my form which, upon submit, is
passing validation and I see that the expected variables are returned
correctly, however no insert is made to the database.
def brand():
auth.settings.register_onaccept = _register_brand
if request.args(0) == 'register':
form = SQLFORM.factory(db.auth_user,db.brands,
fields=['brand_name', 'brand_logo', 'first_name','last_name','email'
,'password'])
if form.process(keepvalues=True).accepts(request,session):
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
return dict(form=form)
def _register_brand(form):
db.auth_user.update_or_insert(**db.auth_user._filter_fields(form.vars))
brandID = db.brands.update_or_insert(**db.brands._filter_fields(form.vars
))
I'm not sure what I'm missing. If I go through the normal user
registration then the user is created, however with this custom form
neither the user or the brand tables are updated with a new record.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.