finished import function
This commit is contained in:
@@ -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,14 +152,16 @@ 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
|
||||
def update(request, ls, season, cur_md):
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ urlpatterns = patterns('',
|
||||
url(r'^$', 'tipp.views.home', name='home'),
|
||||
url(r'^login$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
|
||||
url(r'^logout$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
|
||||
url(r'^import/(?P<ls>.*)/(?P<season>\d{4})$', 'tipp.views.import', name='import'),
|
||||
url(r'^getSeason/(?P<ls>.*)/(?P<season>\d{4})$', 'tipp.views.getSeason'),
|
||||
url(r'^update/(?P<ls>.*)/(?P<season>\d{4})/(?P<cur_md>\d{2})$', 'tipp.views.update', name='update'),
|
||||
url(r'^matchday/(?P<ls>.{3,})/(?P<season>\d{4})/(?P<matchday>\d{2})$', 'tipp.views.matchday', name='matchday'),
|
||||
url(r'^charts/(?P<ls>\w{3,})/(?P<season>\d{4})$', 'tipp.views.charts', name='charts'),
|
||||
|
||||
Reference in New Issue
Block a user