finished import function

This commit is contained in:
2016-06-07 18:19:22 +02:00
parent 20f0a836e5
commit 5a0a1daa39
2 changed files with 17 additions and 7 deletions

View File

@@ -131,12 +131,20 @@ def profile(request, pk):
'img': img}
)
@login_required
def import(request, ls, season):
@login_required
def getSeason(request, ls, season):
ol = OpenLiga()
teams = ol.getTeams(str(season), ls)
season = ol.getSeason(str(season), ls)
for team in teams[0]:
t = Team(
teamID=team['teamID'],
name=team['teamName']
)
t.save()
for match in season[0]:
m = Match(matchID=unicode(match['matchID']),
matchDateTime=datetime.strptime(unicode(match['matchDateTime']), '%Y-%m-%d %H:%M:%S'),
@@ -144,13 +152,15 @@ def import(request, ls, season):
matchday=int(match['groupOrderID']),
idTeam1=Team.objects.get(teamID=int(match['idTeam1'])),
idTeam2=Team.objects.get(teamID=int(match['idTeam2'])),
pointsTeam1=pointsTeam1,
pointsTeam2=pointsTeam2,
pointsTeam1=match['pointsTeam1'],
pointsTeam2=match['pointsTeam2'],
finished=bool(match['matchIsFinished']),
season=match['leagueSaison'],
leagueShortcut=match['leagueShortcut']
)
m.save()
return redirect("matchday", ls=ls, season=season, matchday=get_current_md(ls, season))
@login_required
@@ -532,8 +542,8 @@ def get_current_md(ls,season):
return(current_md)
def get_current_ls():
return("bl1")
return("em2016")
def get_current_season():
return("2015")
return("2016")