Skip to content
Extraits de code Groupes Projets
Valider 7cd9b63b rédigé par Nicolas Joyard's avatar Nicolas Joyard
Parcourir les fichiers

Use last mandate as main_mandate even when finished

parent 5457ba81
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# coding: utf-8 # coding: utf-8
import datetime
from django.db import models from django.db import models
from representatives.models import Mandate from representatives.models import Mandate
...@@ -35,7 +33,6 @@ class RepresentativeViewMixin(object): ...@@ -35,7 +33,6 @@ class RepresentativeViewMixin(object):
Note that this will butcher your database if you don't use Note that this will butcher your database if you don't use
self.prefetch_related. self.prefetch_related.
""" """
today = datetime.date.today()
representative.country = None representative.country = None
representative.main_mandate = None representative.main_mandate = None
...@@ -44,8 +41,7 @@ class RepresentativeViewMixin(object): ...@@ -44,8 +41,7 @@ class RepresentativeViewMixin(object):
if m.constituency.country_id and not representative.country: if m.constituency.country_id and not representative.country:
representative.country = m.constituency.country representative.country = m.constituency.country
if ((m.end_date is None or m.end_date > today) and if (m.group.kind == 'group' and
m.group.kind == 'group' and
not representative.main_mandate): not representative.main_mandate):
representative.main_mandate = m representative.main_mandate = m
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter