Merge branch 'master' of github.com:jamesturk/fowl

This commit is contained in:
Erin Braswell 2012-05-27 17:06:53 -04:00
commit 39c2122856
4 changed files with 99 additions and 6 deletions

View File

@ -93,14 +93,21 @@ class Event(models.Model):
winner = kwargs.get('winner', None)
win_type = kwargs.get('win_type', None)
title_at_stake = kwargs.get('title_at_stake', False)
notes = kwargs.get('notes', '')
match = Match.objects.create(event=self, title_at_stake=title_at_stake)
match = Match.objects.create(event=self,
title_at_stake=title_at_stake,
notes=notes
)
for team in teams:
mt = MatchTeam.objects.create(match=match)
if not isinstance(team, (list, tuple)):
team = [team]
for member in team:
member = Star.objects.get(pk=member)
try:
member = Star.objects.get(pk=member)
except Star.DoesNotExist:
raise ValueError('invalid star pk {0}'.format(member))
if not mt.title and member.title:
# multiple titles?
mt.title = member.title
@ -120,6 +127,7 @@ class Match(models.Model):
winner = models.ForeignKey(Star, null=True)
win_type = models.CharField(max_length=10, choices=WIN_TYPES)
title_at_stake = models.BooleanField(default=False)
notes = models.TextField(blank=True, default='')
def record_win(self, star, win_type):
self.teams.filter(members__pk=star).update(victorious=True)
@ -202,7 +210,11 @@ class Match(models.Model):
return points
def __unicode__(self):
return ' vs. '.join(str(t) for t in self.teams.all().prefetch_related('members'))
ret = ' vs. '.join(str(t) for t in
self.teams.all().prefetch_related('members'))
if not self.winner_id:
ret += ' (no contest)'
return ret
admin.site.register(Match)

View File

@ -13,6 +13,7 @@
padding-bottom: 40px;
}
.event-title { font-size: 125%; }
.match-notes { font-size: 80%; color: #999999; }
</style>
<link href="{% static "assets/css/bootstrap-responsive.css" %}" rel="stylesheet">

View File

@ -34,7 +34,10 @@ PPVs, since the creation of this league.</p>
<tbody>
{% for match, tp_list in event.match_list.items %}
<tr>
<td>{{match}}</td>
<td>
<p>{{match}}</p>
<p class="match-notes">{{match.notes}}</p>
</td>
<td>
<ul>
{% for tp in tp_list %}

View File

@ -1,11 +1,20 @@
from django.contrib.auth.models import User
from fowl.game.models import League, Star, Team, Event, Match
from fowl.game.tests import _give_belt
User.objects.all().delete()
League.objects.all().delete()
Team.objects.all().delete()
Event.objects.all().delete()
_give_belt('cmpunk', 'wwe')
_give_belt('sheamus', 'heavyweight')
_give_belt('kofikingston', 'tag')
_give_belt('rtruth', 'tag')
_give_belt('layla', 'diva')
_give_belt('codyrhodes', 'ic')
_give_belt('santinomarella', 'us')
james = User.objects.create_superuser('james', 'james.p.turk@gmail.com', 'james')
erin = User.objects.create_user('erin', 'erin.braswell@gmail.com', 'erin')
kevin = User.objects.create_user('kevin', 'kevin.wohlgenant@gmail.com', 'kevin')
@ -14,7 +23,7 @@ gm_punk = Team.objects.create(name='GM Punk', login=james, league=league)
awesome = Team.objects.create(name="I'm AWEsome!", login=kevin, league=league)
cobra = Team.objects.create(name='COBRA!', login=erin, league=league)
punks = ('cmpunk', 'kane', 'rtruth', 'codyrhodes', 'sin-cara', 'antoniocesaro',
punks = ('cmpunk', 'markhenry', 'rtruth', 'codyrhodes', 'tensai', 'antoniocesaro',
'wadebarrett', 'aj', 'bethphoenix')
for person in punks:
gm_punk.add_star(pk=person)
@ -25,10 +34,11 @@ for person in awesomes:
awesome.add_star(pk=person)
cobras = ('santinomarella', 'dolphziggler', 'kofikingston', 'albertodelrio',
'randyorton', 'bigshow', 'christian', 'layla', 'natalya')
'randyorton', 'bigshow', 'titusoneil', 'layla', 'natalya')
for person in cobras:
cobra.add_star(pk=person)
# RAW 5/14
event = Event.objects.create(name='RAW', date='2012-05-14')
event.add_match(['cmpunk', 'santinomarella'], ['codyrhodes', 'danielbryan'],
winner='cmpunk', win_type='pin')
@ -41,4 +51,71 @@ event.add_match(['brodusclay', 'kofikingston', 'rtruth'],
event.add_match('chrisjericho', 'randyorton',
winner='chrisjericho', win_type='DQ',
note='Sheamus interfered, giving Jericho the win')
# MISSING heyman's appearance
league.score_event(event)
# Smackdown 5/18
event = Event.objects.create(name='Smackdown', date='2012-05-18')
event.add_match(['kofikingston', 'rtruth'], ['darrenyoung', 'titusoneil'],
winner='rtruth', win_type='pin')
event.add_match('damien-sandow', 'yoshitatsu', notes='sandow refuses to fight')
event.add_match('zackryder', 'danielbryan', winner='danielbryan',
win_type='submission')
event.add_match('cmpunk', 'kane', winner='kane', win_type='dq',
notes='bryan hits kane with a chair, kane wins by DQ')
event.add_match('santinomarella', 'codyrhodes', winner='santinomarella',
win_type='pin')
event.add_match('randyorton', 'sheamus', winner='sheamus', win_type='pin')
# MISSING sandow brawl points
league.score_event(event)
# Over the Limit 5/20
event = Event.objects.create(name='Over the Limit', date='2012-05-20')
event.add_match('zackryder', 'kane', winner='kane', win_type='pin')
event.add_match('alexriley', 'christian', 'curthawkins', 'darrenyoung',
'davidotunga', 'drewmcintyre', 'ezekieljackson',
'thegreatkhali', 'heathslater', 'jeyuso', 'jimmyuso', 'jindermahal',
'jtg', 'michaelmcgillicutty', 'themiz', 'titusoneil',
'tylerreks', 'tysonkidd', 'williamregal', 'yoshitatsu',
winner='christian', win_type='pin')
event.add_match(['kofikingston', 'rtruth'], ['dolphziggler', 'jackswagger'],
winner='kofikingston', win_type='pin', title_at_stake=True)
event.add_match('layla', 'bethphoenix', winner='layla',
win_type='pin', title_at_stake=True)
event.add_match('sheamus', 'randyorton', 'chrisjericho', 'albertodelrio',
winner='sheamus', win_type='pin', title_at_stake=True)
event.add_match('brodusclay', 'themiz', winner='brodusclay', win_type='pin')
event.add_match('christian', 'codyrhodes', winner='christian', win_type='pin',
title_at_stake=True)
_give_belt('christian', 'ic')
event.add_match('cmpunk', 'danielbryan', winner='cmpunk', win_type='pin',
title_at_stake=True)
event.add_match('ryback', 'camacho', winner='ryback', win_type='pin')
event.add_match('john-laurinaitis', 'johncena', 'bigshow',
winner='johnlaurinaitis',
win_type='pin', notes='Big Show interferes in a big way')
league.score_event(event)
# 5/21 RAW
event = Event.objects.create(name='RAW', date='2012-05-21')
event.add_match('davidotunga', 'johncena', winner='johncena',
win_type='submission')
# Brawl: Tyler Reks & Curt Hawkins & Titus O'Neil & Daren Young & Sheamus
# Brawl: Santino vs. Ricardo
event.add_match('albertodelrio', 'randyorton', winner='randyorton',
win_type='DQ', notes='Jericho codebreaks RKO, Orton wins')
event.add_match('danielbryan', 'kane', winner='danielbryan', win_type='DQ',
notes='Kane uses chair, Bryan wins')
event.add_match('christian', 'jindermahal', winner='christian', win_type='pin')
event.add_match('bethphoenix', 'kellykelly', winner='bethphoenix',
win_type='pin')
event.add_match(['johncena', 'sheamus'],
['tensai', 'jackswagger', 'dolphziggler'],
notes='Lumberjacks rush ring, no contest')
league.score_event(event)
# GM Punk
# drop mark henry for sin cara
# drop tensai for kane
# COBRA!
# drop titus o'neil and add christian