1
0
mirror of https://gitlab.crans.org/bde/nk20-scripts synced 2024-12-25 00:42:23 +00:00

In the force delete script, delete transactions transaction by transaction

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-04-22 15:13:14 +02:00
parent 5ce65e36a8
commit 0fc9c4c50e
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -78,11 +78,11 @@ class Command(BaseCommand):
# Deleting transactions
transactions = Transaction.objects.filter(Q(source=user.note) | Q(destination=user.note)).all()
local_deleted += list(transactions)
if kwargs['verbosity'] >= 1:
for tr in transactions:
for tr in transactions:
if kwargs['verbosity'] >= 1:
self.stdout.write(f"Removing {tr}...")
if force:
transactions.delete()
if force:
tr.delete()
# Deleting memberships
memberships = user.memberships.all()