

def write_assignments_to_csv(writer, queryset):
    field_names = ['ID', 'Titel', 'Auftragstext', 'Modul']
    writer.writerow(field_names)
    for assignment in queryset.all():
        writer.writerow([assignment.id, assignment.title, assignment.assignment, assignment.module])

def write_submissions_to_csv(writer, queryset):
    field_names = ['Assignment-ID', 'Text', 'Mit Lehrer geteilt', ]
    writer.writerow(field_names)
    for submission in queryset.all():
        writer.writerow([submission.assignment.id, submission.text, submission.final])
