Skip to content
Extraits de code Groupes Projets
Valider b07a3bc3 rédigé par Bram's avatar Bram
Parcourir les fichiers

[enh] export personal data of a representative

parent 3cabf7cf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -8,8 +8,13 @@ class Command(BaseCommand): ...@@ -8,8 +8,13 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
result = [] result = []
personal_fields = ("first_name", "last_name", "full_name", "birth_place", "cv")
gender_dict = dict(Representative.GENDER)
for representative in Representative.objects.all(): for representative in Representative.objects.all():
reps = {"id": representative.remote_id} reps = {"id": representative.remote_id}
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
result.append(reps) result.append(reps)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter