From 2e9466d1b49f97a5f89d6945aa4f78e1935bf760 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Wed, 8 Jun 2022 16:47:13 +0200 Subject: [PATCH] Change auditlogflush management command before_date query filter to apply the filter only on date part of timestamp (#384) --- auditlog/management/commands/auditlogflush.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auditlog/management/commands/auditlogflush.py b/auditlog/management/commands/auditlogflush.py index a5b1397..e57ef2c 100644 --- a/auditlog/management/commands/auditlogflush.py +++ b/auditlog/management/commands/auditlogflush.py @@ -45,7 +45,7 @@ class Command(BaseCommand): if answer: entries = LogEntry.objects.all() if before is not None: - entries = entries.filter(timestamp__lt=before) + entries = entries.filter(timestamp__date__lt=before) count, _ = entries.delete() self.stdout.write("Deleted %d objects." % count) else: