add_representative_country_and_main_mandate is suboptimal
Created by: lauxley
So i was looking for where representative.main_mandate came from and it led me to representatives.views.RepresentativeViewMixin.add_representative_country_and_main_mandate
and i think the same could be done with:
country = representative.mandates.filter(constituency__isnull=False, constituency__country__isnull=False).constituency.country main_mandate = representative.mandates.filter(end_date__gt=today, group__kind='group')
And since it's not so time consuming any more cached properties on the model would be cool ?