Improve activity interface

This commit is contained in:
Yohann D'ANELLO 2020-08-06 17:41:30 +02:00
parent 3806feb67f
commit 4984159a61
1 changed files with 3 additions and 2 deletions

View File

@ -40,7 +40,8 @@ class Command(ImportCommand):
cur.execute("SELECT * FROM activites ORDER by id") cur.execute("SELECT * FROM activites ORDER by id")
n = cur.rowcount n = cur.rowcount
bulk_mgr = BulkCreateManager(chunk_size=chunk) 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") kfet = Club.objects.get(name="Kfet")
pk_activity = 1 pk_activity = 1
for idx, row in enumerate(cur): for idx, row in enumerate(cur):
@ -64,7 +65,7 @@ class Command(ImportCommand):
"name": row["titre"], "name": row["titre"],
"description": row["description"], "description": row["description"],
"location": row["lieu"], "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, "creater_id": NoteUser.objects.get(pk=note).user.id,
"organizer_id": organizer.pk, "organizer_id": organizer.pk,
"attendees_club_id": kfet.pk, # Maybe fix manually "attendees_club_id": kfet.pk, # Maybe fix manually