From c07319d6f4c6a0ff2245f4350c380b3d5c5a4886 Mon Sep 17 00:00:00 2001 From: yoneyan Date: Mon, 9 Sep 2024 00:40:20 +0900 Subject: [PATCH] =?UTF-8?q?#43=20=E6=8E=B2=E8=BC=89=E7=B5=82=E4=BA=86?= =?UTF-8?q?=E3=81=AE=E9=80=9A=E7=9F=A5=E6=83=85=E5=A0=B1=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E3=81=99=E3=82=8B=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97?= =?UTF-8?q?=E3=83=88.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dsbd/management/commands/db_auto_remove.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 dsbd/management/commands/db_auto_remove.py diff --git a/dsbd/management/commands/db_auto_remove.py b/dsbd/management/commands/db_auto_remove.py new file mode 100644 index 0000000..5e942a9 --- /dev/null +++ b/dsbd/management/commands/db_auto_remove.py @@ -0,0 +1,12 @@ +from django.core.management.base import BaseCommand +from django.utils import timezone + +from notice.models import Notice + + +class Command(BaseCommand): + def handle(self, *args, **options): + print("batch process for db_auto_remove") + now = timezone.now() + # 掲載終了の通知情報を削除 + Notice.objects.filter(end_at__lt=now).delete()