From a9c87316d127a4e2636bcd80cfc796850c4a86cc Mon Sep 17 00:00:00 2001 From: ffont Date: Mon, 18 Sep 2023 10:01:28 +0200 Subject: [PATCH] Add timestamp to csv download in attribution page --- accounts/views.py | 10 ++++++---- templates_bw/accounts/attribution.html | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/accounts/views.py b/accounts/views.py index 8f3f574c9..f0c6e17fa 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1148,20 +1148,22 @@ def download_attribution(request): response['Content-Disposition'] = f'attachment; filename="{filename}"' output = io.StringIO() if download == 'csv': - output.write('Download Type,File Name,User,License\r\n') + output.write('Download Type,File Name,User,License,Timestamp\r\n') csv_writer = csv.writer(output, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) for row in qs: csv_writer.writerow( [row['download_type'][0].upper(), row['sound__original_filename'], row['sound__user__username'], license_with_version(row['license__name'] or row['sound__license__name'], - row['license__deed_url'] or row['sound__license__deed_url'])]) + row['license__deed_url'] or row['sound__license__deed_url']), + row['created']]) elif download == 'txt': for row in qs: - output.write("{}: {} by {} | License: {}\n".format(row['download_type'][0].upper(), + output.write("{}: {} by {} | License: {} | Timestamp: {}\n".format(row['download_type'][0].upper(), row['sound__original_filename'], row['sound__user__username'], license_with_version(row['license__name'] or row['sound__license__name'], - row['license__deed_url'] or row['sound__license__deed_url']))) + row['license__deed_url'] or row['sound__license__deed_url']), + row['created'])) response.writelines(output.getvalue()) return response else: diff --git a/templates_bw/accounts/attribution.html b/templates_bw/accounts/attribution.html index 356b35da6..1646a3118 100644 --- a/templates_bw/accounts/attribution.html +++ b/templates_bw/accounts/attribution.html @@ -8,10 +8,12 @@ {% block page-content %}

- This is the list of files you have downloaded. When you use freesound samples (under the "attribution" or "attribution non-commercial license"), you have to credit the original creator of the sound in your work. This list makes it a little bit easier to do so. "S" means sound, "P" means pack.
-

+ This is the list of files you have downloaded. When you use freesound samples under the Attribution or Attribution NonCommercial license, you have to credit the original creator of the sound in your work. + This list makes it easy to do so. "S" means sound, "P" means pack. There are 3 flavors of this list: regular, html or plain text. - You can also download the complete list as csv or plain text. + Alternatively, you can download the complete record of your downloaded sounds in csv or plain text formats. +

+