Ajout de la gestion des catégories

This commit is contained in:
Jean-Marie Favreau
2023-10-21 22:10:31 +02:00
parent a54010db02
commit 52745c4012
15 changed files with 207 additions and 25 deletions

0
src/scripts/__init__.py Normal file
View File

View File

@@ -0,0 +1,25 @@
from agenda_culturel.models import Category
def run():
# concert, théâtre, jeune public, danse, arts du spectacle, exposition
# conférence, nature,
# divers
categories = [
("Théâtre", "THÉ"),
("Concert", "CCR"),
("Danse", "DSE"),
("Arts du spectacle", "SPE"),
("Jeune public", "JEP"),
("Exposition", "EXP"),
("Conférence", "CNF"),
("Nature", "NTR"),
("Divers", "DIV")
]
if len(Category.objects.all()) == 0:
print("On créée des catégories")
for c in categories:
cat = Category(name=c[0], codename=c[1])
cat.save()