From: Jan Szejko Date: Mon, 9 May 2016 14:43:29 +0000 (+0200) Subject: csv export: support for bools and lists X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/30574b902abfedf033f7c71e65f8152a53b5cccc csv export: support for bools and lists --- diff --git a/contact/admin.py b/contact/admin.py index 7581666..0a0aaa0 100644 --- a/contact/admin.py +++ b/contact/admin.py @@ -157,6 +157,11 @@ def extract_view(request, form_tag, extract_type_slug): for key in keys: if key not in record: record[key] = '' + if isinstance(record[key], bool): + record[key] = 'tak' if record[key] else 'nie' + if isinstance(record[key], (list, tuple)): + record[key] = '; '.join(record[key]) + csv_writer.writerow([record[key] for key in keys]) csv_writer.writerow([])