From bdd28c7aae618c780cbb401f779f9f698a74c5a7 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sat, 17 Feb 2018 07:40:28 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20l'=C3=A9valuation=20de=20la=20date,=20non?= =?UTF-8?q?=20plus=20=C3=A0=20l'import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- re2o/utils.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/re2o/utils.py b/re2o/utils.py index 27feecae..ebf3d186 100644 --- a/re2o/utils.py +++ b/re2o/utils.py @@ -48,10 +48,8 @@ from machines.models import Domain, Interface, Machine from users.models import Adherent, User, Ban, Whitelist from preferences.models import Service -DT_NOW = timezone.now() - -def all_adherent(search_time=DT_NOW): +def all_adherent(search_time=timezone.now()): """ Fonction renvoyant tous les users adherents. Optimisee pour n'est qu'une seule requete sql Inspecte les factures de l'user et ses cotisation, regarde si elles @@ -70,7 +68,7 @@ def all_adherent(search_time=DT_NOW): ).distinct() -def all_baned(search_time=DT_NOW): +def all_baned(search_time=timezone.now()): """ Fonction renvoyant tous les users bannis """ return User.objects.filter( ban__in=Ban.objects.filter( @@ -79,7 +77,7 @@ def all_baned(search_time=DT_NOW): ).distinct() -def all_whitelisted(search_time=DT_NOW): +def all_whitelisted(search_time=timezone.now()): """ Fonction renvoyant tous les users whitelistes """ return User.objects.filter( whitelist__in=Whitelist.objects.filter( @@ -88,7 +86,7 @@ def all_whitelisted(search_time=DT_NOW): ).distinct() -def all_has_access(search_time=DT_NOW): +def all_has_access(search_time=timezone.now()): """ Renvoie tous les users beneficiant d'une connexion : user adherent ou whiteliste et non banni """ return User.objects.filter(