From ba4f6652ed305a1120eaec1afeb70aeac2e3508e Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 8 May 2025 09:36:41 +0200 Subject: [PATCH] attempt #3 --- api/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/views.py b/api/views.py index 2b07f9f..7f14fd2 100644 --- a/api/views.py +++ b/api/views.py @@ -429,10 +429,11 @@ def xls_to_csv(request): data_xls = pd.read_excel(full_path, sheet_name=target_sheet, index_col=None) csv_file_name = create_random_filename('players', 'csv') output_path = os.path.join(directory, csv_file_name) - data_xls.to_csv(output_path, sep=';', index=False, encoding='utf-8') + full_output_path = default_storage.path(output_path) + data_xls.to_csv(full_output_path, sep=';', index=False, encoding='utf-8') # Send the processed file back - with default_storage.open(output_path, 'rb') as file: + with default_storage.open(full_output_path, 'rb') as file: response = HttpResponse(file.read(), content_type='application/octet-stream') response['Content-Disposition'] = f'attachment; filename="players.csv"'