fixed conflicts
This commit is contained in:
commit
10d08a8f8a
@ -202,7 +202,7 @@ class Match(models.Model):
|
|||||||
return points
|
return points
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return ' vs. '.join(str(t) for t in self.teams.all())
|
return ' vs. '.join(str(t) for t in self.teams.all().prefetch_related('members'))
|
||||||
|
|
||||||
admin.site.register(Match)
|
admin.site.register(Match)
|
||||||
|
|
||||||
@ -227,5 +227,5 @@ class TeamPoints(models.Model):
|
|||||||
match = models.ForeignKey(Match)
|
match = models.ForeignKey(Match)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return "{0} recieved {1} points for {2}'s performance in {3}".format(
|
return "{0} received {1} points for {2}'s performance in {3}".format(
|
||||||
self.team, self.points, self.star, self.match)
|
self.team, self.points, self.star, self.match)
|
@ -12,6 +12,7 @@
|
|||||||
padding-top: 60px;
|
padding-top: 60px;
|
||||||
padding-bottom: 40px;
|
padding-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
.event-title { font-size: 125%; }
|
||||||
</style>
|
</style>
|
||||||
<link href="{% static "assets/css/bootstrap-responsive.css" %}" rel="stylesheet">
|
<link href="{% static "assets/css/bootstrap-responsive.css" %}" rel="stylesheet">
|
||||||
|
|
||||||
|
@ -5,102 +5,56 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<header class="jumbotron subhead" id="overview">
|
<header class="jumbotron subhead" id="overview">
|
||||||
<h1>Events</h1>
|
<h1>Events</h1>
|
||||||
<p class="lead">Every event that has taken place on RAW, Smackdown, and on PPVs, since the creation of this league.</p>
|
<p class="lead">Every event that has taken place on RAW, Smackdown, and on
|
||||||
|
PPVs, since the creation of this league.</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="accordion" id="accordion2">
|
{% for event in events.values %}
|
||||||
<div class="accordion-group">
|
|
||||||
<div class="accordion-heading">
|
|
||||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
|
|
||||||
RAW 5/20/2012 3-9-3
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div id="collapseOne" class="accordion-body collapse in">
|
|
||||||
<div class="accordion-inner">
|
|
||||||
|
|
||||||
<table class="table">
|
<div class="accordion-group">
|
||||||
<thead>
|
<div class="accordion-heading">
|
||||||
<tr>
|
<a class="accordion-toggle event-title" data-toggle="collapse"
|
||||||
<th>Event</th>
|
data-parent="#accordion" href="#event-{{event.id}}">
|
||||||
<th>Points</th>
|
{{event.name}} - {{event.date}}
|
||||||
</tr>
|
</a>
|
||||||
</thead>
|
{% for team,score in event.scores.iteritems %}
|
||||||
<tbody>
|
{{team}}: {{score}}
|
||||||
<tr>
|
{% endfor %}
|
||||||
<td>Rey Mysterio vs Sin Cara</td>
|
</div>
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>GM Punk gets 2 points for Sin Cara victory</li>
|
|
||||||
<li>COBRA! gets 0 points for Sin Cara victory</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Big Show & Kane vs Kaval</td>
|
|
||||||
<td>
|
|
||||||
<ul>
|
|
||||||
<li>COBRA! gets 2 points for Big Show Victory</li>
|
|
||||||
<li>GM Punk gets 2 points for Kane victory</li>
|
|
||||||
<li>COBRA! & GM Punk get -2 points for murder</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
<div id="event-{{event.id}}" class="accordion-body collapse in">
|
||||||
</div>
|
<div class="accordion-inner">
|
||||||
</div>
|
<table class="table">
|
||||||
<div class="accordion-group">
|
<thead>
|
||||||
<div class="accordion-heading">
|
<tr>
|
||||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
|
<th>Event</th>
|
||||||
Smackdown 5/25/2012 0-4-2
|
<th>Scoring</th>
|
||||||
</a>
|
</tr>
|
||||||
</div>
|
</thead>
|
||||||
<div id="collapseTwo" class="accordion-body collapse">
|
<tbody>
|
||||||
<div class="accordion-inner">
|
{% for match, tp_list in event.match_list.items %}
|
||||||
<table class="table">
|
<tr>
|
||||||
<thead>
|
<td>{{match}}</td>
|
||||||
<tr>
|
<td>
|
||||||
<th>Event</th>
|
<ul>
|
||||||
<th>Points</th>
|
{% for tp in tp_list %}
|
||||||
</tr>
|
{% if tp.points %}
|
||||||
</thead>
|
<li> {{tp.team}} received {{tp.points}}
|
||||||
<tbody>
|
point{{tp.points|pluralize}} for {{tp.star}}
|
||||||
<tr>
|
</li>
|
||||||
<td>Cody Rhodes vs John Cena</td>
|
{% endif %}
|
||||||
<td>
|
{% endfor %}
|
||||||
<ul>
|
</ul>
|
||||||
<li>GM Punk gets 2 points for Cody Rhodes victory</li>
|
</td>
|
||||||
<li>I'm AWEsome gets 0 points for Cody Rhodes victory</li>
|
</tr>
|
||||||
</ul>
|
{% endfor %}
|
||||||
</td>
|
</tbody>
|
||||||
</tr>
|
</table>
|
||||||
<tr>
|
|
||||||
<td>The Miz vs Santino</td>
|
</div>
|
||||||
<td>
|
</div>
|
||||||
<ul>
|
</div>
|
||||||
<li>COBRA! gets 2 points for Santino Victory</li>
|
|
||||||
<li>COBRA! gets 4 points for US Championship title defense</li>
|
{% endfor %}
|
||||||
</ul>
|
</div>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-group">
|
|
||||||
<div class="accordion-heading">
|
|
||||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseThree">
|
|
||||||
Summerslam 2012 ?-?-?
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div id="collapseThree" class="accordion-body collapse">
|
|
||||||
<div class="accordion-inner">
|
|
||||||
Didn't want to get presumptious with the scores on this one
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,7 +1,24 @@
|
|||||||
|
from collections import defaultdict
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from fowl.game.models import TeamPoints
|
||||||
|
|
||||||
|
|
||||||
def events(request):
|
def events(request):
|
||||||
return render(request, "events.html")
|
events = {}
|
||||||
|
points = TeamPoints.objects.filter().order_by('match',
|
||||||
|
'team').select_related()
|
||||||
|
for tp in points:
|
||||||
|
event_id = tp.match.event_id
|
||||||
|
if event_id not in events:
|
||||||
|
events[event_id] = tp.match.event
|
||||||
|
events[event_id].scores = {}
|
||||||
|
events[event_id].match_list = {}
|
||||||
|
events[event_id].match_list.setdefault(tp.match, []
|
||||||
|
).append(tp)
|
||||||
|
events[event_id].scores.setdefault(tp.team.name, 0)
|
||||||
|
events[event_id].scores[tp.team.name] += tp.points
|
||||||
|
return render(request, "events.html", {'events': events})
|
||||||
|
|
||||||
|
|
||||||
def stables(request):
|
def stables(request):
|
||||||
return render(request, "stables.html")
|
return render(request, "stables.html")
|
||||||
|
@ -77,10 +77,13 @@ MIDDLEWARE_CLASSES = (
|
|||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||||
# Uncomment the next line for simple clickjacking protection:
|
# Uncomment the next line for simple clickjacking protection:
|
||||||
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
INTERNAL_IPS = ('127.0.0.1',)
|
||||||
|
|
||||||
ROOT_URLCONF = 'fowl.urls'
|
ROOT_URLCONF = 'fowl.urls'
|
||||||
|
|
||||||
# Python dotted path to the WSGI application used by Django's runserver.
|
# Python dotted path to the WSGI application used by Django's runserver.
|
||||||
@ -100,6 +103,7 @@ INSTALLED_APPS = (
|
|||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
|
'debug_toolbar',
|
||||||
'fowl.game',
|
'fowl.game',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ from fowl.game.models import League, Star, Team, Event, Match
|
|||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
League.objects.all().delete()
|
League.objects.all().delete()
|
||||||
Team.objects.all().delete()
|
Team.objects.all().delete()
|
||||||
|
Event.objects.all().delete()
|
||||||
|
|
||||||
james = User.objects.create_superuser('james', 'james.p.turk@gmail.com', 'james')
|
james = User.objects.create_superuser('james', 'james.p.turk@gmail.com', 'james')
|
||||||
erin = User.objects.create_user('erin', 'erin.braswell@gmail.com', 'erin')
|
erin = User.objects.create_user('erin', 'erin.braswell@gmail.com', 'erin')
|
||||||
@ -27,3 +28,17 @@ cobras = ('santinomarella', 'dolphziggler', 'kofikingston', 'albertodelrio',
|
|||||||
'randyorton', 'bigshow', 'christian', 'layla', 'natalya')
|
'randyorton', 'bigshow', 'christian', 'layla', 'natalya')
|
||||||
for person in cobras:
|
for person in cobras:
|
||||||
cobra.add_star(pk=person)
|
cobra.add_star(pk=person)
|
||||||
|
|
||||||
|
event = Event.objects.create(name='RAW', date='2012-05-14')
|
||||||
|
event.add_match(['cmpunk', 'santinomarella'], ['codyrhodes', 'danielbryan'],
|
||||||
|
winner='cmpunk', win_type='pin')
|
||||||
|
event.add_match('aliciafox', 'bethphoenix', winner='bethphoenix',
|
||||||
|
win_type='pin')
|
||||||
|
event.add_match('bigshow', 'kane', winner='kane', win_type='pin')
|
||||||
|
event.add_match(['brodusclay', 'kofikingston', 'rtruth'],
|
||||||
|
['themiz', 'jackswagger', 'dolphziggler'],
|
||||||
|
winner='brodusclay', win_type='pin')
|
||||||
|
event.add_match('chrisjericho', 'randyorton',
|
||||||
|
winner='chrisjericho', win_type='DQ',
|
||||||
|
note='Sheamus interfered, giving Jericho the win')
|
||||||
|
league.score_event(event)
|
||||||
|
Loading…
Reference in New Issue
Block a user