on event save actions

This commit is contained in:
James Turk 2012-05-28 20:05:27 -04:00
parent 46ec093e0d
commit 9ee51a524b
3 changed files with 17 additions and 4 deletions

View File

@ -44,6 +44,7 @@
<a class="brand" href="#"><img src="{% static "images/duck.png" %}" width="30" height="30"> </a> <a class="brand" href="#"><img src="{% static "images/duck.png" %}" width="30" height="30"> </a>
<div class="nav-collapse"> <div class="nav-collapse">
<ul class="nav"> <ul class="nav">
{% if league %}
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{league}}<b class="caret"></b></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{league}}<b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
@ -52,9 +53,11 @@
{% endfor %} {% endfor %}
</ul> </ul>
</li> </li>
<li {% if view == "league" %}class="active"{%endif%}><a href="{% url league league.id %}">League</a></li> <li {% if view == "league" %}class="active"{%endif%}><a href="{% url league league.id %}">League</a></li>
<li {% if view == "events" %}class="active"{%endif%}><a href="{% url events league.id %}">Events</a></li> <li {% if view == "events" %}class="active"{%endif%}><a href="{% url events league.id %}">Events</a></li>
<li {% if view == "roster" %}class="active"{%endif%}><a href="{% url roster league.id %}">Roster</a></li> <li {% if view == "roster" %}class="active"{%endif%}><a href="{% url roster league.id %}">Roster</a></li>
{% endif %}
</ul> </ul>
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div> </div>

View File

@ -2,6 +2,7 @@
{% block content %} {% block content %}
<form class="well form-inline" action="." method="post"> <form class="well form-inline" action="." method="post">
<label>Show Name</label> <label>Show Name</label>
<input type="hidden" name="id" value="{{event.id}}">
<input type="text" class="span3" name="name" value="{{event.name}}" <input type="text" class="span3" name="name" value="{{event.name}}"
placeholder="RAW/Smackdown/PPV Name"> placeholder="RAW/Smackdown/PPV Name">
<label>Date</label> <label>Date</label>

View File

@ -55,6 +55,15 @@ def edit_event(request, event):
edict['matches'][int(match)-1]['teams'].append(v) edict['matches'][int(match)-1]['teams'].append(v)
event = Event.from_dict(edict) 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", return render(request, "edit_event.html",
{'event': event, {'event': event,