From: Guillaume Pellerin Date: Fri, 12 Jul 2024 09:07:49 +0000 (+0200) Subject: rename X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e317c87375dca64c7a060aea3599b6b8ab4dcf86;p=teleforma.git rename --- diff --git a/teleforma/management/commands/teleforma-delete-period-scripts.py b/teleforma/management/commands/teleforma-delete-period-scripts.py deleted file mode 100644 index eb7be414..00000000 --- a/teleforma/management/commands/teleforma-delete-period-scripts.py +++ /dev/null @@ -1,26 +0,0 @@ -import os -import datetime -from optparse import make_option -from django.conf import settings -from django.core.management.base import BaseCommand, CommandError -from django.contrib.auth.models import User -from django.template.defaultfilters import slugify -from teleforma.exam.models import Script - - -class Command(BaseCommand): - help = "Delete all exam scripts older than a given year" - args = "year" - admin_email = 'webmaster@parisson.com' - - def add_arguments(self, parser): - parser.add_argument('args', nargs='*') - - def handle(self, *args, **options): - year = int(args[0]) - date = datetime.datetime(day=31, month=12, year=year) - scripts = Script.objects.filter(date_added__lte=date) - for script in scripts: - os.remove(script.file.path) - script.delete() - \ No newline at end of file