From 800a8dca90eb836a7447a687997a8b6999a2e6a4 Mon Sep 17 00:00:00 2001 From: Nell Date: Sat, 6 Sep 2025 12:01:56 +0200 Subject: [PATCH] fix delete --- app/torrent/management/commands/torrent_event.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/torrent/management/commands/torrent_event.py b/app/torrent/management/commands/torrent_event.py index 9c757f8..3b089c8 100644 --- a/app/torrent/management/commands/torrent_event.py +++ b/app/torrent/management/commands/torrent_event.py @@ -32,7 +32,9 @@ def update_transmission_data(): def clean_old_torrents(): expired_date = timezone.now() - timedelta(days=settings.TORRENT_TTL) - Torrent.objects.filter(date_created__lt=expired_date).first().delete() + torrent = Torrent.objects.filter(date_created__lt=expired_date).first() + if torrent: + torrent.delete() class Command(BaseCommand):