diff --git a/tipp/views.py b/tipp/views.py index 9c946be..f7c6de2 100644 --- a/tipp/views.py +++ b/tipp/views.py @@ -150,15 +150,26 @@ def getSeason(request, ls, season): season = ol.getSeason(str(season), ls) md = get_current_md(ls) + return_vals = [] for team in teams[0]: t = Team( teamID=team['teamID'], name=team['teamName'], iconURL = team['teamIconURL'] ) - if t.teamID is None: + + """ + check if object exits and do insert if not + """ + try: + to = Team.objects.get(teamID=int(t.teamID)) + except Team.DoesNotExist: t.save() + if to.iconURL is None: + t.save(update_fields=['iconURL']) + + for match in season[0]: m = Match(matchID=unicode(match['matchID']), matchDateTime=datetime.strptime( @@ -626,7 +637,7 @@ def get_current_md(ls): return(cur_md['groupOrderID']) def get_current_ls(): - return("em2016") + return("bl1") def get_current_season(): return("2016")