From 0265752bed22cbb352ec8966b3183f13bfc1f073 Mon Sep 17 00:00:00 2001 From: luxcem <af@laquadrature.net> Date: Fri, 6 Mar 2015 17:04:26 +0100 Subject: [PATCH] export/import representatives photo --- representatives/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/representatives/utils.py b/representatives/utils.py index 765ec657..09f559ed 100644 --- a/representatives/utils.py +++ b/representatives/utils.py @@ -14,6 +14,7 @@ def export_a_representative(representative): reps["personal"] = {field: getattr(representative, field) for field in PERSONAL_FIELDS} reps["personal"]["gender"] = GENDER_DICT[representative.gender] reps["personal"]["birth_date"] = representative.birth_date.strftime("%F") if representative.birth_date else None + reps["personal"]["photo"] = representative.photo reps["contact"] = {} reps["contact"]["emails"] = [{"email": email.email, "type": email.kind} for email in representative.email_set.all()] @@ -77,6 +78,7 @@ def import_representatives_from_format(data, verbose=False): representative.birth_place = reps["personal"]["birth_place"] representative.birth_date = datetime.strptime(reps["personal"]["birth_date"], "%Y-%m-%d") if reps["personal"]["birth_date"] else None representative.cv = reps["personal"]["cv"] + representative.photo = reps["personal"]["photo"] representative.gender = reverted_gender_dict[reps["personal"]["gender"]] representative.save() -- GitLab