django - How to get time stamp of database update using psycopg2 -


i implementing http streaming django. when user opens webpage, there connection made server returns data when new entry made postgresql table.

let's call model "m", model when updated returns data client have view get_update timestamp checking , returns data. how can go doing it?

without seeing code it's hard know, understand you're trying query last time table updated. if that's correct, add "last_updated" attribute on model , query that, so:

models.py

class yourmodel(models.model):     last_updated = models.datetimefield(auto_now=true) 

views.py

def get_update():     time_updated = yourmodel.objects.last().last_updated     return(time_updated) 

Comments