setupleague2 and divisions in roster
This commit is contained in:
parent
535c1268f7
commit
04698f0942
@ -152,11 +152,15 @@ def league(request, league_id):
|
||||
return render(request, "league.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
def roster(request, league_id):
|
||||
league = get_object_or_404(League, pk = league_id)
|
||||
leagues = League.objects.filter(teams__login=request.user)
|
||||
divisions = {'raw': [], 'smackdown': [], 'other': [], 'divas': []}
|
||||
for star in Star.objects.all():
|
||||
divisions[star.division].append(star)
|
||||
context = {
|
||||
'stars': Star.objects.all(),
|
||||
'divisions': divisions,
|
||||
'view': 'roster',
|
||||
'league': league,
|
||||
'leagues': leagues
|
||||
|
27
setup_league2.py
Normal file
27
setup_league2.py
Normal file
@ -0,0 +1,27 @@
|
||||
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()
|
||||
|
||||
Star.objects.get(pk='cmpunk').win_title('wwe', '2011-11-20')
|
||||
Star.objects.get(pk='santinomarella').win_title('us', '2012-03-05')
|
||||
Star.objects.get(pk='sheamus').win_title('world', '2012-04-01')
|
||||
Star.objects.get(pk='layla').win_title('divas', '2012-04-29')
|
||||
Star.objects.get(pk='kofikingston').win_title('tag', '2012-04-30',
|
||||
tag_partner=Star.objects.get(pk='rtruth'))
|
||||
Star.objects.get(pk='christian').win_title('ic', '2011-05-20')
|
||||
|
||||
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')
|
||||
league = League.objects.create(name='Fire Pro Wrestling')
|
||||
gm_punk = Team.objects.create(name='GM Punk', login=james, league=league,
|
||||
color='#1540a4')
|
||||
awesome = Team.objects.create(name="I'm AWEsome!", login=kevin, league=league,
|
||||
color='#f5a506')
|
||||
cobra = Team.objects.create(name='COBRA!', login=erin, league=league,
|
||||
color='#05c405')
|
Loading…
Reference in New Issue
Block a user