From 9ee51a524b7c5c885d34c7743162c5d3ba22ec35 Mon Sep 17 00:00:00 2001 From: James Turk Date: Mon, 28 May 2012 20:05:27 -0400 Subject: [PATCH] on event save actions --- fowl/game/templates/base.html | 11 +++++++---- fowl/game/templates/edit_event.html | 1 + fowl/game/views.py | 9 +++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/fowl/game/templates/base.html b/fowl/game/templates/base.html index cc418a2..76b03a8 100644 --- a/fowl/game/templates/base.html +++ b/fowl/game/templates/base.html @@ -44,6 +44,7 @@ diff --git a/fowl/game/templates/edit_event.html b/fowl/game/templates/edit_event.html index 84131af..5f8a8ce 100644 --- a/fowl/game/templates/edit_event.html +++ b/fowl/game/templates/edit_event.html @@ -2,6 +2,7 @@ {% block content %}
+ diff --git a/fowl/game/views.py b/fowl/game/views.py index 9457eaf..5901e33 100644 --- a/fowl/game/views.py +++ b/fowl/game/views.py @@ -55,6 +55,15 @@ def edit_event(request, event): edict['matches'][int(match)-1]['teams'].append(v) event = Event.from_dict(edict) + # score the event for all active leagues + for league in League.objects.filter(active=True): + league.score_event(event) + # after event is scored, do title change on all matches + for match in event.matches.all(): + match.do_title_change() + # TODO: title changes should take place inline somehow? + # (would fix for case if title changes twice) + event = event.to_dict() return render(request, "edit_event.html", {'event': event,