8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 15:33:45 +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 Jean-Romain Garnier
parent bef496b3e2
commit e323972b96

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()