Skip to content

Commit

Permalink
fix: csv read
Browse files Browse the repository at this point in the history
  • Loading branch information
varshamenon4 committed Mar 29, 2024
1 parent a383e03 commit 28780d9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def handle(self, *args, **options):
# self.add_course_staff_from_csv(csv_file, batch_size, batch_delay)

# if csv_path:
with open(csv_path) as csv_file:
with open(csv_path, 'r') as csv_file:
self.add_course_staff_from_csv(csv_file, batch_size, batch_delay)

logger.info('Bulk add course staff complete!')
Expand All @@ -67,7 +67,7 @@ def add_course_staff_from_csv(self, csv_file, batch_size, batch_delay):
"""
Add the given set of course staff provided in csv
"""
reader = list(csv.DictReader(csv_file))
reader = csv.DictReader(csv_file)
users_to_create = []
users_existing = {u.username for u in User.objects.filter(username__in=[r.get('username') for r in reader])}
for row in reader:
Expand Down

0 comments on commit 28780d9

Please sign in to comment.