Просмотр исходного кода

Fixes #18928: Fix support for cascading deletions when cleaning up expired changelog records

Jeremy Stretch 11 месяцев назад
Родитель
Сommit
c5801f9881
1 измененных файлов с 1 добавлено и 2 удалено
  1. 1 2
      netbox/extras/management/commands/housekeeping.py

+ 1 - 2
netbox/extras/management/commands/housekeeping.py

@@ -5,7 +5,6 @@ import requests
 from django.conf import settings
 from django.core.cache import cache
 from django.core.management.base import BaseCommand
-from django.db import DEFAULT_DB_ALIAS
 from django.utils import timezone
 from packaging import version
 
@@ -53,7 +52,7 @@ class Command(BaseCommand):
                         ending=""
                     )
                     self.stdout.flush()
-                ObjectChange.objects.filter(time__lt=cutoff)._raw_delete(using=DEFAULT_DB_ALIAS)
+                ObjectChange.objects.filter(time__lt=cutoff).delete()
                 if options['verbosity']:
                     self.stdout.write("Done.", self.style.SUCCESS)
             elif options['verbosity']: