From 4984159a61642a0d3668e85daf39472b59b86447 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Thu, 6 Aug 2020 17:41:30 +0200 Subject: [PATCH] Improve activity interface --- management/commands/import_activities.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/management/commands/import_activities.py b/management/commands/import_activities.py index d43a80c..d3ffd99 100644 --- a/management/commands/import_activities.py +++ b/management/commands/import_activities.py @@ -40,7 +40,8 @@ class Command(ImportCommand): cur.execute("SELECT * FROM activites ORDER by id") n = cur.rowcount bulk_mgr = BulkCreateManager(chunk_size=chunk) - activity_type_id = ActivityType.objects.get(name="Pot").pk # Need to be fixed manually + pot_id = ActivityType.objects.get(name="Pot").pk + club_id = ActivityType.objects.get(name="Soirée de club").pk kfet = Club.objects.get(name="Kfet") pk_activity = 1 for idx, row in enumerate(cur): @@ -64,7 +65,7 @@ class Command(ImportCommand): "name": row["titre"], "description": row["description"], "location": row["lieu"], - "activity_type_id": activity_type_id, # By default Pot + "activity_type_id": pot_id if row["liste"] else club_id, "creater_id": NoteUser.objects.get(pk=note).user.id, "organizer_id": organizer.pk, "attendees_club_id": kfet.pk, # Maybe fix manually