i have model field name 'timestamp' datetime field, , when print them in python manage.py shell get:
>>> a.timestamp datetime.datetime(2013, 7, 15, 18, 45, tzinfo=<utc>)
now.... running django celery task every 30 seconds suppose retrieve matching objects in last 30 seconds.
how can (thing = mymodelname.objects.filter(.. ..)
i hope manage explain self.
thank in advanced.
update: when typing in server (python shell)
datetime.datetime.now() getting
datetime.datetime(2013, 7, 15, 20, 34, 4, 366166)
mymodelname.objects.filter(timestamp__gte=(datetime.datetime.now() - datetime.timedelta(seconds=30)))
Comments
Post a Comment