increase separation between fantasy and... wrestling
This commit is contained in:
parent
e5731e334b
commit
ec7fb9492a
@ -34,9 +34,6 @@ class Star(models.Model):
|
||||
tag_partner.title = title
|
||||
tag_partner.save()
|
||||
|
||||
def drafted(self, league):
|
||||
return self.teams.filter(league=league).count() >= 1
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
@ -221,11 +218,11 @@ class Team(models.Model):
|
||||
stars = models.ManyToManyField(Star, related_name='teams')
|
||||
|
||||
def add_star(self, pk):
|
||||
member = Star.objects.get(pk=pk)
|
||||
if member.drafted(self.league):
|
||||
star = Star.objects.get(pk=pk)
|
||||
if self.league.teams.filter(stars=star).count() >= 1:
|
||||
raise ValueError('cannot add {0}, already drafted in {1}'.format(
|
||||
member, self.league))
|
||||
self.stars.add(member)
|
||||
star, self.league))
|
||||
self.stars.add(star)
|
||||
|
||||
def drop_star(self, pk):
|
||||
member = Star.objects.get(pk=pk)
|
||||
|
@ -7,7 +7,7 @@ def _give_belt(star, belt):
|
||||
Star.objects.get(pk=star).win_title(belt)
|
||||
|
||||
class StarTest(TestCase):
|
||||
def test_win_belt(self):
|
||||
def test_win_title(self):
|
||||
cmpunk = Star.objects.create(pk='cmpunk', name='CM Punk', title='wwe')
|
||||
dbry = Star.objects.create(pk='danielbryan', name='Daniel Bryan')
|
||||
kofi = Star.objects.create(pk='kofi', name='Kofi Kingston',
|
||||
|
Loading…
Reference in New Issue
Block a user