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