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

Merge branch 'master' of git.laquadrature.net:memopol/compotista_django-representatives

Conflicts:
	representatives/utils.py
parents 127d0455 f014d769
Branches
Étiquettes
Aucune requête de fusion associée trouvée
......@@ -153,7 +153,11 @@ def import_representatives_from_format(data, verbose=False):
representative.mandate_set.all().delete()
for mandate in reps["mandates"]:
constituency, = Constituency.objects.get_or_create(name=mandate['constituency'])
constituency, created = Constituency.objects.get_or_create(
name=mandate['constituency']
)
group, created = Group.objects.get_or_create(
name=mandate['name'],
abbreviation=mandate['short_id'],
......@@ -170,7 +174,9 @@ def import_representatives_from_format(data, verbose=False):
active=mandate["current"],
)
# Create a country if not exist
# Create a country if it does not exist
# The representative's country is the one associated
# with the last 'country' mandate
country_mandate = representative.mandate_set.filter(
group__kind='country'
).order_by('-begin_date')[0:1].get()
......
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