Update the database without refreshing the website?

21 views
Skip to first unread message

Aydin S

unread,
Dec 8, 2015, 9:21:08 AM12/8/15
to web2py-users
I am running into this issue that the database does not update without refreshing the website.
In model db.py I have:

db.define_table('Table1',
    Field('var1', 'integer'),
from module1 import insert_record
insert_record(db)

and in a module1 I write on the database and also get access to the database:

from gluon import current
def insert_record(db):
    db = current.db
    test1 = 2 #for example
    db.Table1.insert(var=test1)
    test2 = db().select(db.Table1.var1, orderby=~db.Table1.id, limitby=(0, 1))[0].var1

Then test2 is used to show up on a display. test2 changes because var1 changes. The problem is that test2 does seem to get updated when var1 changes without refreshing the website (I refresh the databases). Is it because this action is in the models? Should I use scheduler to do this?
Reply all
Reply to author
Forward
0 new messages