From 262ded3602f9fc2f556047c2b4f1f230b7256364 Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Sat, 22 Jun 2013 16:07:43 +0200 Subject: [PATCH] [enh] export mandates --- .../commands/export_in_representatives_format.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/representatives/management/commands/export_in_representatives_format.py b/representatives/management/commands/export_in_representatives_format.py index 2b70530..aff7eaa 100644 --- a/representatives/management/commands/export_in_representatives_format.py +++ b/representatives/management/commands/export_in_representatives_format.py @@ -35,6 +35,18 @@ class Command(BaseCommand): "phones": [phone.id for phone in address.phone_set.all()], } for address in representative.address_set.all()] + reps["mandates"] = [{ + "name": mandate.name, + "type": mandate.kind, + "short_id": mandate.short_id, + "url_official": mandate.url, + "constituency": mandate.constituency, + "role": mandate.role, + "begin_date": mandate.begin_date.strftime("%F") if mandate.begin_date else None, + "end_date": mandate.end_date.strftime("%F") if mandate.end_date else None, + "current": mandate.active, + } for mandate in representative.mandate_set.all()] + result.append(reps) print json.dumps(result, indent=4) -- GitLab