Skip to content

Commit

Permalink
feat: use read replica for export to CSV on admin
Browse files Browse the repository at this point in the history
  • Loading branch information
igobranco committed Apr 24, 2024
1 parent 4082612 commit 0db55cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nau_openedx_extensions/utils/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import csv
import datetime

from common.djangoapps.util.query import use_read_replica_if_available # lint-amnesty, pylint: disable=import-error
from django.http import HttpResponse


Expand Down Expand Up @@ -39,7 +40,7 @@ def transform_field(csv_field):
# Write a first row with header information
writer.writerow([field.verbose_name if hasattr(field, 'verbose_name') else str(field) for field in fields])
# Write data rows
for obj in queryset:
for obj in use_read_replica_if_available(queryset):
data_row = []
for field in fields:
if not isinstance(field, str):
Expand Down

0 comments on commit 0db55cd

Please sign in to comment.