From a5b0d082a728b06e5e02f4d64632ac0b0a572aec Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Mon, 27 Nov 2017 17:18:41 +0100 Subject: Adaptation des commandes cleancourses et listtimetables au changements --- management/commands/listtimetables.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'management/commands/listtimetables.py') diff --git a/management/commands/listtimetables.py b/management/commands/listtimetables.py index 6df7ba5..171fc2b 100644 --- a/management/commands/listtimetables.py +++ b/management/commands/listtimetables.py @@ -14,7 +14,7 @@ # along with celcatsanitizer. If not, see . from django.core.management.base import BaseCommand -from edt.models import Timetable +from edt.models import Source class Command(BaseCommand): @@ -24,14 +24,13 @@ class Command(BaseCommand): parser.add_argument("--order-by-id", action="store_true") def handle(self, *args, **options): - timetables = Timetable.objects.all() + sources = Source.objects.all() if options["order_by_id"]: - timetables = timetables.order_by("id") - else: - timetables = timetables.order_by("year__name", "name") + sources = sources.order_by("id") - for timetable in timetables: - self.stdout.write("{0} (id: {1})".format(timetable, timetable.id)) + for source in sources: + self.stdout.write("{0}\t: {1} (id: {2})".format(", ".join([str(timetable) for timetable in source.timetables.all()]), + source, source.id)) self.stdout.write("") self.stdout.write(self.style.SUCCESS("Done.")) -- cgit v1.2.1 From 8a71b0a55847e8783006b5a9514f64e0129578c9 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Mon, 27 Nov 2017 17:23:11 +0100 Subject: Fonction pour formater les emplois du temps à partir d’une source --- management/commands/listtimetables.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'management/commands/listtimetables.py') diff --git a/management/commands/listtimetables.py b/management/commands/listtimetables.py index 171fc2b..25f641b 100644 --- a/management/commands/listtimetables.py +++ b/management/commands/listtimetables.py @@ -29,8 +29,8 @@ class Command(BaseCommand): sources = sources.order_by("id") for source in sources: - self.stdout.write("{0}\t: {1} (id: {2})".format(", ".join([str(timetable) for timetable in source.timetables.all()]), - source, source.id)) + self.stdout.write("{0}\t: {1} (id: {2})".format(source.formatted_timetables, + source, source.id)) self.stdout.write("") self.stdout.write(self.style.SUCCESS("Done.")) -- cgit v1.2.1 From c9388e29b2f9ee18a9e190683a8a33fb710684c5 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sat, 27 Jan 2018 17:56:45 +0100 Subject: PEP8 --- management/commands/listtimetables.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'management/commands/listtimetables.py') diff --git a/management/commands/listtimetables.py b/management/commands/listtimetables.py index 25f641b..7892855 100644 --- a/management/commands/listtimetables.py +++ b/management/commands/listtimetables.py @@ -29,8 +29,9 @@ class Command(BaseCommand): sources = sources.order_by("id") for source in sources: - self.stdout.write("{0}\t: {1} (id: {2})".format(source.formatted_timetables, - source, source.id)) + self.stdout.write("{0}\t: {1} (id: {2})" + .format(source.formatted_timetables, + source, source.id)) self.stdout.write("") self.stdout.write(self.style.SUCCESS("Done.")) -- cgit v1.2.1 From 77a4b75431cfab7348db73b563dd005ce64be14a Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sun, 28 Jan 2018 11:14:34 +0100 Subject: Changements dans le formatage du code pour le rendre plus lisible --- management/commands/listtimetables.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'management/commands/listtimetables.py') diff --git a/management/commands/listtimetables.py b/management/commands/listtimetables.py index 7892855..a3ef223 100644 --- a/management/commands/listtimetables.py +++ b/management/commands/listtimetables.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017 Alban Gruin +# Copyright (C) 2017-2018 Alban Gruin # # celcatsanitizer is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -29,9 +29,8 @@ class Command(BaseCommand): sources = sources.order_by("id") for source in sources: - self.stdout.write("{0}\t: {1} (id: {2})" - .format(source.formatted_timetables, - source, source.id)) + self.stdout.write("{0}\t: {1} (id: {2})".format( + source.formatted_timetables, source, source.id)) self.stdout.write("") self.stdout.write(self.style.SUCCESS("Done.")) -- cgit v1.2.1 From 9b312281e0f2a9668ab90d77f212c9618daec7db Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sat, 10 Feb 2018 15:13:20 +0100 Subject: Correction des imports --- management/commands/listtimetables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'management/commands/listtimetables.py') diff --git a/management/commands/listtimetables.py b/management/commands/listtimetables.py index a3ef223..d17399a 100644 --- a/management/commands/listtimetables.py +++ b/management/commands/listtimetables.py @@ -14,7 +14,7 @@ # along with celcatsanitizer. If not, see . from django.core.management.base import BaseCommand -from edt.models import Source +from ...models import Source class Command(BaseCommand): -- cgit v1.2.1 From f36bceaddcd3315235fe9ce9172ea4f73ce405ba Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sun, 22 Apr 2018 12:44:03 +0200 Subject: Suppression du paramètre --order-by-id dans listtimetables Ce paramètre est devenu inutile depuis l’ajout des sources, qui sont déjà triées par leur ID. --- management/commands/listtimetables.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'management/commands/listtimetables.py') diff --git a/management/commands/listtimetables.py b/management/commands/listtimetables.py index d17399a..bd27e92 100644 --- a/management/commands/listtimetables.py +++ b/management/commands/listtimetables.py @@ -20,13 +20,8 @@ from ...models import Source class Command(BaseCommand): help = "List timetables in the database" - def add_arguments(self, parser): - parser.add_argument("--order-by-id", action="store_true") - def handle(self, *args, **options): sources = Source.objects.all() - if options["order_by_id"]: - sources = sources.order_by("id") for source in sources: self.stdout.write("{0}\t: {1} (id: {2})".format( -- cgit v1.2.1