Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
D
django-representatives
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Political Memory
  • django-representatives
  • Issues
  • #19

Closed
Open
Opened Feb 19, 2016 by robin Tissot@lauxley
  • Report abuse
Report abuse

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)[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 ?

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: memopol/django-representatives#19