diff --git a/edx_exams/apps/core/management/commands/bulk_add_course_staff.py b/edx_exams/apps/core/management/commands/bulk_add_course_staff.py index d023d792..471c360d 100644 --- a/edx_exams/apps/core/management/commands/bulk_add_course_staff.py +++ b/edx_exams/apps/core/management/commands/bulk_add_course_staff.py @@ -4,7 +4,6 @@ import time from django.core.management.base import BaseCommand -# from django.db import transaction from edx_exams.apps.core.models import CourseStaffRole, User @@ -44,7 +43,6 @@ def add_arguments(self, parser): dest='batch_delay', help='Time delay in seconds for each batch') - # @transaction.atomic def handle(self, *args, **options): """ The main logic and entry point of the management command @@ -75,6 +73,8 @@ def add_course_staff_from_csv(self, csv_file, batch_size, batch_delay): ) time.sleep(batch_delay) + # bulk create course staff + for i in range(0, len(reader), batch_size): CourseStaffRole.objects.bulk_create( (CourseStaffRole( user=User.objects.get(username=row.get('username')),