Skip to content
Extraits de code Groupes Projets
Valider 8cbc5535 rédigé par Nicolas Joyard's avatar Nicolas Joyard
Parcourir les fichiers

Prefetch representative chamber

parent 01b175ca
Branches
Étiquettes
Aucune requête de fusion associée trouvée
......@@ -30,7 +30,7 @@ class RepresentativeViewMixin(object):
def add_representative_country_and_main_mandate(self, representative):
"""
Set representative country and main_mandate.
Set representative country, main_mandate and chamber.
Note that this will butcher your database if you don't use
self.prefetch_related.
......@@ -53,6 +53,9 @@ class RepresentativeViewMixin(object):
if representative.country and representative.main_mandate:
break
if representative.main_mandate:
representative.chamber = representative.main_mandate.group.chamber
return representative
......
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