Skip to content

add_representative_country_and_main_mandate is suboptimal #19

@lauxley

Description

@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)[0].constituency.country

main_mandate = representative.mandates.filter(end_date__gt=today, group__kind='group')[0]

And since it's not so time consuming any more cached properties on the model would be cool ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions