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"), ("Concert"), ("Danse"), ("Arts du spectacle"), ("Jeune public"), ("Exposition"), ("Conférence"), ("Nature"), ("Autre"), ] if len(Category.objects.all()) <= 1: print("On créée des catégories") for c in categories: cat = Category( name=c[0] ) cat.save()