adding
This commit is contained in:
16
boatmovers/management/commands/saveranking.py
Normal file
16
boatmovers/management/commands/saveranking.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import sys
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from boatmovers.models import Athlete, Crew, Race, Result
|
||||
|
||||
import pandas as pd
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
athletes = Athlete.objects.filter(trueskill_exposed__gt=0,
|
||||
dummy=False).order_by('-trueskill_exposed','-birth_year','last_name','first_name')
|
||||
df = pd.DataFrame(athletes.values())
|
||||
filename = "media/boatmovers_"+datetime.now().strftime("%Y-%m-%d")+".csv"
|
||||
df.to_csv(filename)
|
||||
Reference in New Issue
Block a user