update_representatives_score.py 433 Bytes
Newer Older
Arnaud Fabre's avatar
Arnaud Fabre committed
1 2 3 4 5 6 7 8 9 10 11 12
import pyprind

from django.core.management.base import BaseCommand
from legislature.models import MemopolRepresentative

class Command(BaseCommand):
    
    def handle(self, *args, **options):
        bar = pyprind.ProgBar(MemopolRepresentative.objects.all().count())
        for representative in MemopolRepresentative.objects.all():
            representative.update_score()
            bar.update(item_id = str(representative))