Ejemplo n.º 1
0
def make_team_participant(request, event=None, form=None, tour=None):
    team = Team()
    participant = Participant()
    # Unike teamtitle? not working.. -_- required for Challonge!
    # if form.cleaned_data['title'] in Participant.objects.filter(tournament=tour):
    #    messages.error(request, u'This teamname is already taken')
    team.title = form.cleaned_data['title']
    team.teamleader = request.user
    team.save()
    for user in form.cleaned_data['members']:
        team.members.add(user)
    team.save()
    participant.team = team
    participant.tournament = tour
    participant.save()
    messages.success(request, u'You have successfully registered your team for this tournament')
Ejemplo n.º 2
0
def make_participant(user, tour):
    p = Participant()
    p.user = user
    p.tournament = tour
    p.save()