Now I feel more than a little stupid. Obviously, I had it as form=SQLFORM(db.mygroup) originally, then added the Field later, which turned SQLFORM into SQLFORM.factory, which causes me to have to insert into the db manually. Must be having a senior moment.
On Jul 13, 6:48 pm, weheh <richard_gor...@verizon.net> wrote: > I'm working on an app. During development, I wanted to make sure I > could do a clean build of the db. So I wiped everything -- deleted all > files under databases, sessions, errors, and any uploaded files and > old static files that were generated by the app. > > So I start over populating the db. Some of the data I'm entering by > CSV and some manually. One of the things I'm entering manually is a > table created thus: > > def create(): > > form=SQLFORM.factory(db.mygroup,Field('invite','string')) > > if form.accepts(request.vars,session): > mygroup_id=form.vars.id > > admin=auth.add_group('mygroup%d'%mygroup_id,'Group leader') > auth.add_membership(admin) > auth.add_permission(...) > auth.add_permission(...) > auth.add_permission(...) > > session.flash=DIV('Created mygroup: > %s'%form.vars.name,_class='info') > redirect(URL(r=request,f='show_mygroups')) > elif form.errors: > response.flash=DIV('Please correct errors and resubmit > form',_class='error') > return dict(title=T('Build Group'),form=form) > > Before wiping the db, this used to work OK. Now, the mygroup_id gets > stuck on the first entry and doesn't budge off of 1, no matter how > many times I submit the group. Obviously, the db is not being updated. > However, eclipse shows the body of the form.accepts being executed. > What's going on?