From e440f555c05f0b2658a68ae28af20cc60dae3c58 Mon Sep 17 00:00:00 2001 From: janmax <mail-github@jmx.io> Date: Thu, 4 May 2017 20:13:05 +0200 Subject: [PATCH] Include username in csv export --- core/views/export_csv.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/views/export_csv.py b/core/views/export_csv.py index 147e85b0..36065414 100644 --- a/core/views/export_csv.py +++ b/core/views/export_csv.py @@ -12,7 +12,7 @@ def export_csv(request): response['Content-Disposition'] = 'attachment; filename="grady_results.csv"' writer = csv.writer(response) - writer.writerow(['Matrikel', 'Name', 'Summe'] + + writer.writerow(['Matrikel', 'Username', 'Name', 'Sum'] + [s.name for s in SubmissionType.objects.all().order_by('name')]) for student in Student.objects.all(): @@ -22,6 +22,7 @@ def export_csv(request): score_list = [0] * SubmissionType.objects.count() writer.writerow([ student.matrikel_no, + student.user.username, student.name, sum(score_list), *score_list -- GitLab