Skip to content
Extraits de code Groupes Projets
Valider b51b963f rédigé par luxcem's avatar luxcem
Parcourir les fichiers

Moves fix mandates active commands to memopol

parent 6febaf6d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
import datetime
from django.core.management.base import BaseCommand
from representatives.models import Mandate
from django.db import transaction
class Command(BaseCommand):
@transaction.atomic
def handle(self, *args, **options):
date = datetime.datetime.now().date()
mandates = Mandate.objects.all()
n = len(mandates)
for i, mandate in enumerate(mandates):
mandate.active = mandate.end_date > date
mandate.save()
print("%s/%s\r" % (i, n)),
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