From 7cd9b63b405775f6a2a9d7209e3d431120ed2de4 Mon Sep 17 00:00:00 2001
From: Nicolas Joyard <joyard.nicolas@gmail.com>
Date: Thu, 9 Jun 2016 07:20:58 +0200
Subject: [PATCH] Use last mandate as main_mandate even when finished

---
 memopol/views/representative_mixin.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/memopol/views/representative_mixin.py b/memopol/views/representative_mixin.py
index 98b27d40..55547c69 100644
--- a/memopol/views/representative_mixin.py
+++ b/memopol/views/representative_mixin.py
@@ -1,7 +1,5 @@
 # coding: utf-8
 
-import datetime
-
 from django.db import models
 
 from representatives.models import Mandate
@@ -35,7 +33,6 @@ class RepresentativeViewMixin(object):
         Note that this will butcher your database if you don't use
         self.prefetch_related.
         """
-        today = datetime.date.today()
 
         representative.country = None
         representative.main_mandate = None
@@ -44,8 +41,7 @@ class RepresentativeViewMixin(object):
             if m.constituency.country_id and not representative.country:
                 representative.country = m.constituency.country
 
-            if ((m.end_date is None or m.end_date > today) and
-                    m.group.kind == 'group' and
+            if (m.group.kind == 'group' and
                     not representative.main_mandate):
 
                 representative.main_mandate = m
-- 
GitLab