def populate_competitions(self): challenge = Challenge.objects.all()[0] maps = list(Map.objects.all()) competition = Competition() competition.type = 'friendly' competition.challenge = challenge competition.save() for map in maps: competition.maps.add(map)
def populate_competitions(): challenge = Challenge.objects.all()[0] maps = list(Map.objects.all()) types = ['elim', 'league', 'double'] for i in range(3): competition = Competition() competition.type = types[i] competition.challenge = challenge competition.save() for map in maps: competition.maps.add(map)