import function created

This commit is contained in:
2016-06-07 17:22:28 +02:00
parent 364166d84b
commit c0eb583a69

View File

@@ -131,6 +131,28 @@ def profile(request, pk):
'img': img} 'img': img}
) )
@login_required
def import(request, ls, season):
ol = OpenLiga()
season = ol.getSeason(str(season), ls)
for match in season[0]:
m = Match(matchID=unicode(match['matchID']),
matchDateTime=datetime.strptime(unicode(match['matchDateTime']), '%Y-%m-%d %H:%M:%S'),
group=int(match['groupID']),
matchday=int(match['groupOrderID']),
idTeam1=Team.objects.get(teamID=int(match['idTeam1'])),
idTeam2=Team.objects.get(teamID=int(match['idTeam2'])),
pointsTeam1=pointsTeam1,
pointsTeam2=pointsTeam2,
finished=bool(match['matchIsFinished']),
season=match['leagueSaison'],
leagueShortcut=match['leagueShortcut']
)
m.save()
@login_required @login_required
def update(request, ls, season, cur_md): def update(request, ls, season, cur_md):
""" """