From dc70973ca1aaaaad71fe6e5c9a2c104433e808a9 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Mon, 6 Nov 2023 18:16:45 +0100 Subject: [PATCH] =?UTF-8?q?on=20ajuste=20les=20scripts=20pour=20remplir=20?= =?UTF-8?q?de=20mani=C3=A8re=20plus=20'cr=C3=A9dible'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/create_categories.py | 18 +++++++++--------- src/scripts/create_fake_events.py | 9 +++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/scripts/create_categories.py b/src/scripts/create_categories.py index b03e463..fc2ccd7 100644 --- a/src/scripts/create_categories.py +++ b/src/scripts/create_categories.py @@ -6,15 +6,15 @@ def run(): # divers categories = [ - ("Théâtre", "Au théâtre", "THÉ"), - ("Concert", "Concerts", "CCR"), - ("Danse", "En danse", "DSE"), - ("Arts du spectacle", None, "SPE"), - ("Jeune public", "Pour le jeune public", "JEP"), - ("Exposition", "Expositions", "EXP"), - ("Conférence", "Conférences", "CNF"), - ("Nature", "Événements nature", "NTR"), - ("Autre", "Autres événements", "ATR") + ("Théâtre", "Au théâtre", "T"), + ("Concert", "Concerts", "C"), + ("Danse", "Danse", "D"), + ("Arts du spectacle", None, "S"), + ("Jeune public", "Pour le jeune public", "J"), + ("Exposition", "Expositions", "E"), + ("Conférence", "Conférences", "C"), + ("Nature", "Événements nature", "N"), + ("Autre", "Autres événements", "A") ] if len(Category.objects.all()) == 0: diff --git a/src/scripts/create_fake_events.py b/src/scripts/create_fake_events.py index 4a15fe0..40318c7 100644 --- a/src/scripts/create_fake_events.py +++ b/src/scripts/create_fake_events.py @@ -34,11 +34,12 @@ def run(): 'tags': [tags[random.randint(0, len(tags) - 1)] for i in range(0, random.randint(0, 10))] } - if random.randint(0, 1) == 1: - fields["end_day"] = (sday + timedelta(days=random.randint(0, 6))).date() if random.randint(0, 1) == 1: fields["start_time"] = random_hour() - if random.randint(0, 1) == 1: - fields["end_time"] = random_hour() + else: + if random.randint(0, 5) == 1: + fields["end_day"] = (sday + timedelta(days=random.randint(0, 6))).date() + if random.randint(0, 1) == 1: + fields["end_time"] = random_hour() faker.create(fields)