Commit 8cbc5535 authored by Nicolas Joyard's avatar Nicolas Joyard

Prefetch representative chamber

parent 01b175ca
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment