mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Tweak ObjectChange queryset for cleanup
This commit is contained in:
@ -145,7 +145,7 @@ class ObjectChangeMiddleware(object):
|
|||||||
# one or more changes being logged.
|
# one or more changes being logged.
|
||||||
if settings.CHANGELOG_RETENTION and random.randint(1, 100) == 1:
|
if settings.CHANGELOG_RETENTION and random.randint(1, 100) == 1:
|
||||||
cutoff = timezone.now() - timedelta(days=settings.CHANGELOG_RETENTION)
|
cutoff = timezone.now() - timedelta(days=settings.CHANGELOG_RETENTION)
|
||||||
purged_count, _ = ObjectChange.objects.filter(
|
purged_count, _ = ObjectChange.objects.unrestricted().filter(
|
||||||
time__lt=cutoff
|
time__lt=cutoff
|
||||||
).delete()
|
).delete()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user