예제 #1
0
    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)
예제 #2
0
파일: models.py 프로젝트: kalaiR/evewat
    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)
예제 #3
0
    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)
예제 #4
0
 def online(self):
   if self.last_update:
     timeout = utils.get_timeout()
     cutoff = datetime.now() - timedelta(minutes = timeout)
     return cutoff < self.last_update
   return False