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
categories = [
("Théâtre", "Au théâtre", "T"),
("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:

View File

@ -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)