From 5673b199c5c3f62465d3a84b8652af3d98eba8e0 Mon Sep 17 00:00:00 2001 From: grisel-davy Date: Thu, 8 Oct 2020 23:24:37 +0200 Subject: [PATCH] split query into two filters --- users/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/users/models.py b/users/models.py index f4e8c0fd..f35149dc 100755 --- a/users/models.py +++ b/users/models.py @@ -932,8 +932,8 @@ class User( """ if self.state == self.STATE_NOT_YET_ACTIVE: if self.facture_set.filter(valid=True).filter( - ~(Q(vente__duration_membership__isnull=True) | Q(vente__duration_membership=0)) | \ - ~(Q(vente__duration_days_membership__isnull=True) | Q(vente__duration_days_membership=0)) + ~(Q(vente__duration_membership__isnull=True) | Q(vente__duration_membership=0)))\ + .filter(~(Q(vente__duration_days_membership__isnull=True) | Q(vente__duration_days_membership=0)) ).exists() or OptionalUser.get_cached_value("all_users_active"): self.state = self.STATE_ACTIVE self.save()