on ajuste les scripts pour remplir de manière plus 'crédible'

This commit is contained in:
Jean-Marie Favreau 2023-11-06 18:16:45 +01:00
parent 604c3591d7
commit dc70973ca1
2 changed files with 14 additions and 13 deletions

View File

@ -6,15 +6,15 @@ def run():
# divers # divers
categories = [ categories = [
("Théâtre", "Au théâtre", "T"), ("Théâtre", "Au théâtre", "T"),
("Concert", "Concerts", "CCR"), ("Concert", "Concerts", "C"),
("Danse", "En danse", "DSE"), ("Danse", "Danse", "D"),
("Arts du spectacle", None, "SPE"), ("Arts du spectacle", None, "S"),
("Jeune public", "Pour le jeune public", "JEP"), ("Jeune public", "Pour le jeune public", "J"),
("Exposition", "Expositions", "EXP"), ("Exposition", "Expositions", "E"),
("Conférence", "Conférences", "CNF"), ("Conférence", "Conférences", "C"),
("Nature", "Événements nature", "NTR"), ("Nature", "Événements nature", "N"),
("Autre", "Autres événements", "ATR") ("Autre", "Autres événements", "A")
] ]
if len(Category.objects.all()) == 0: if len(Category.objects.all()) == 0:

View File

@ -34,10 +34,11 @@ def run():
'tags': [tags[random.randint(0, len(tags) - 1)] for i in range(0, random.randint(0, 10))] '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: if random.randint(0, 1) == 1:
fields["start_time"] = random_hour() fields["start_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: if random.randint(0, 1) == 1:
fields["end_time"] = random_hour() fields["end_time"] = random_hour()
faker.create(fields) faker.create(fields)