def active(self, timeout=None): if not timeout: timeout = utils.get_timeout() now = datetime.now() cutoff = now - timedelta(minutes=timeout) return self.get_query_set().filter(last_update__gte=cutoff)
def active(self, timeout=None): """ Retrieves only visitors who have been active within the timeout period. """ if not timeout: timeout = utils.get_timeout() now = datetime.now() cutoff = now - timedelta(minutes=timeout) return self.get_query_set().filter(last_update__gte=cutoff)
def online(self): if self.last_update: timeout = utils.get_timeout() cutoff = datetime.now() - timedelta(minutes = timeout) return cutoff < self.last_update return False