Ejemplo n.º 1
0
def team_create(request):
    """
    """
    if request.method == "POST":
        team_form = TeamForm(request.POST)
        if team_form.is_valid():
            p = request.user.get_profile()
            t = team_form.save(commit=False)
            t = Team.createTeam(t.name, p, t.size)
    else:
        team_form = TeamForm()

    return render_to_response('create_team.html', locals(),
                              context_instance=RequestContext(request))
Ejemplo n.º 2
0
for i in range(0,500):
    u = User.objects.create_user(username=u'test%d' % (i), email=u'*****@*****.**', password='******')
    u.save()
    #the purpose of all the mod's is to make the numbers feel more random in the sample data.
    p = Player.createPlayer(u'player%d' % (i), (mod(i, 9) + 1) * 100 + (mod(i, 9) * 7) + i, 'us', u)
    p.port_row = rand(0,5)
    p.port_column = rand(0,5)
    p.port_iconset = rand(0,2)
    p.save()
    print p

#create 50 filled teams
for i in range(0,50):
    random_team_size = rand(1,4)
    t = Team.createTeam(name=u'team%d' % (i),
                        leader = Player.objects.all()[i+1],
                        size=random_team_size)

    for j in range(1,random_team_size):
        #pick a player not chosen before
        p = Player.objects.all()[(i*4) + j + 1]
        #add and except them to the team
        t.add_player(p)
        t.accept_player(p)

    print t

#make 50 teams that are NOT filled.
for i in range(50,100):
    p = Player.objects.all()[(i*4) + j]
    t = Team.objects.create(name=u'team%d' % (i),