On ne créé les catégories que s'il en existe déjà
This commit is contained in:
		@@ -87,9 +87,13 @@ new_cats = [
 | 
			
		||||
def create_categories(apps, catlist):
 | 
			
		||||
    Category = apps.get_model("agenda_culturel", "Category")
 | 
			
		||||
 | 
			
		||||
    cats = [Category(name=c.name, color=c.color, position=c.position, pictogram=c.get_pictogram_file()) for c in catlist]
 | 
			
		||||
    # only create new categories if old ones are present to avoid filling 
 | 
			
		||||
    # an empty database with ghost categories
 | 
			
		||||
    if Category.objects.count() > 1:
 | 
			
		||||
 | 
			
		||||
    Category.objects.bulk_create(cats)
 | 
			
		||||
        cats = [Category(name=c.name, color=c.color, position=c.position, pictogram=c.get_pictogram_file()) for c in catlist]
 | 
			
		||||
 | 
			
		||||
        Category.objects.bulk_create(cats)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user