From 565239180e2cc386156e80c98566df2c77f55463 Mon Sep 17 00:00:00 2001 From: Jan-Jelle Kester Date: Mon, 7 Sep 2020 09:10:37 +0200 Subject: [PATCH] Review improvements --- auditlog/management/commands/auditlogflush.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/auditlog/management/commands/auditlogflush.py b/auditlog/management/commands/auditlogflush.py index 00e7647..ecf4bd7 100644 --- a/auditlog/management/commands/auditlogflush.py +++ b/auditlog/management/commands/auditlogflush.py @@ -13,13 +13,13 @@ class Command(BaseCommand): def handle(self, *args, **options): answer = options['yes'] - while answer is None: - print("This action will clear all log entries from the database.") + if answer is None: + self.stdout.write("This action will clear all log entries from the database.") response = input("Are you sure you want to continue? [y/N]: ").lower().strip() - answer = True if response == 'y' else False if response == 'n' else None + answer = response == 'y' if answer: count, _ = LogEntry.objects.all().delete() - print("Deleted %d objects." % count) + self.stdout.write("Deleted %d objects." % count) else: - print("Aborted.") + self.stdout.write("Aborted.")