From: Guillaume Pellerin Date: Mon, 26 Jan 2026 21:12:53 +0000 (+0100) Subject: add command to extract users having uploaded same script filename X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=ae7136db54f50918479b67530c7cc3ff865cf244;p=teleforma.git add command to extract users having uploaded same script filename (HOTFIX) --- diff --git a/teleforma/management/commands/teleforma-get-same-scripts.py b/teleforma/management/commands/teleforma-get-same-scripts.py new file mode 100644 index 00000000..21d479cd --- /dev/null +++ b/teleforma/management/commands/teleforma-get-same-scripts.py @@ -0,0 +1,20 @@ +from django.core.management.base import BaseCommand +from teleforma.exam.models import Script +from teleforma.models import Period +from datetime import datetime, timedelta + + +class Command(BaseCommand): + help = "Get all users having uploaded the same script filename" + + def handle(self, *args, **options): + name = args[0] + period = Period.objects.get(name=name) + users = [] + scripts = [] + for script in Script.objects.filter(period=period): + ss = Script.objects.filter(file=script.file) + for s in ss: + scripts.append(s) + users.append(s.author) + print(users)