17 lines
599 B
Python
17 lines
599 B
Python
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)
|