works - thanks.

On Aug 26, 10:46 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> you can do this:
>
> form = SQLFORM(db.topic)
> if form.accepts(request.vars, session):
>     session.flash = 'New topic created'
>     redirect(URL(args=request.args))
>
> On Aug 25, 11:11 pm, Richard <richar...@gmail.com> wrote:
>
> > I have a table that references another record of the same table:
>
> > db.define_table('topic',
> >     Field('name'),
> >     Field('category', requires=IS_EMPTY_OR(IS_IN_DB(db, 'topic.id', '%
> > (name)s'))),
> > )
>
> > I then create new records using SQLFORM:
>
> > form = SQLFORM(db.topic)
> > if form.accepts(request.vars, session):
> >      response.flash = 'New topic created'
>
> > This all works, however the newly created record won't appear in the
> > list of categories when the form is next loaded.
> > Is there a way to make the form use the newly created category?
>
> > My temporary hacky solution is to force a reload with:
>
> > form = SQLFORM(db.topic)
> > if form.accepts(request.vars, session):
> >     response.flash = 'New topic created'
> >     form = SQLFORM(db.topic)
>
> > Richard

Reply via email to