Skip to content
Extraits de code Groupes Projets
Valider 0265752b rédigé par luxcem's avatar luxcem
Parcourir les fichiers

export/import representatives photo

parent ed79555d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
2 requêtes de fusion!158Attempt at fixing tests in the restructure branch,!157WIP - Restructure the repository
......@@ -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()
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter