8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-08 10:56:27 +00:00

Reset clean_notyetactive command to its correct state

This commit is contained in:
Jean-Romain Garnier 2020-04-17 19:11:44 +02:00 committed by Gabriel Detraz
parent 6d0c53d667
commit 8b4e203783

View file

@ -28,13 +28,13 @@ from django.utils import timezone
class Command(BaseCommand):
help = "Delete non members users (not yet active or disabled too long ago without an invoice)."
help = "Delete non members users (not yet active)."
def handle(self, *args, **options):
"""First deleting invalid invoices, and then deleting the users"""
days = OptionalUser.get_cached_value("disable_emailnotyetconfirmed")
users_to_delete = (
User.objects.filter(Q(state=User.STATE_NOT_YET_ACTIVE) | Q(state=User.STATE_DISABLED))
User.objects.filter(Q(state=User.STATE_NOT_YET_ACTIVE))
.filter(registered__lte=timezone.now() - timedelta(days=days))
.exclude(facture__valid=True)
.distinct()