fixed redirection in events
This commit is contained in:
parent
6c0cc7d5c8
commit
96121e401e
|
@ -86,15 +86,11 @@ def event(request, event_slug):
|
||||||
player = None
|
player = None
|
||||||
if player:
|
if player:
|
||||||
IsRegistered = True
|
IsRegistered = True
|
||||||
if not player.team and event_info.team_size > 1:
|
|
||||||
return render(request, 'events/create_team.html', {'event' : event_info, 'logged': True, 'wrongpwd': False, 'registered' : True, 'notexist' : False})
|
|
||||||
if event_info.password:
|
if event_info.password:
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
if request.user.is_staff is False:
|
if request.user.is_staff is False:
|
||||||
if not player:
|
if not player:
|
||||||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered})
|
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered})
|
||||||
elif not player.team and event_info.team_size > 1:
|
|
||||||
return render(request, 'events/create_team.html', {'event' : event_info, 'logged': True, 'wrongpwd': False, 'registered' : True, 'notexist' : False})
|
|
||||||
else:
|
else:
|
||||||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered})
|
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered})
|
||||||
ended = False
|
ended = False
|
||||||
|
@ -191,8 +187,8 @@ def submit_pwd(request, event_slug):
|
||||||
else:
|
else:
|
||||||
new = EventPlayer(user=request.user, event=ev)
|
new = EventPlayer(user=request.user, event=ev)
|
||||||
new.save()
|
new.save()
|
||||||
if event_info.team_size > 1:
|
# if event_info.team_size > 1:
|
||||||
return render(request, 'events/create_team.html', {'event' : event_info, 'logged': True, 'wrongpwd': False, 'registered' : True, 'notexist' : False})
|
# return render(request, 'events/create_team.html', {'event' : event_info, 'logged': True, 'wrongpwd': False, 'registered' : True, 'notexist' : False})
|
||||||
return redirect('events:event_info', event_slug=event_slug)
|
return redirect('events:event_info', event_slug=event_slug)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ from random import randint
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def create_team(request, event_slug):
|
def create_team(request, event_slug):
|
||||||
response = redirect('events:create_team', event_slug=event_slug)
|
|
||||||
ev = get_object_or_404(Event, slug=event_slug)
|
ev = get_object_or_404(Event, slug=event_slug)
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if request.user.is_authenticated and ev.team_size > 1:
|
if request.user.is_authenticated and ev.team_size > 1:
|
||||||
|
@ -23,10 +22,11 @@ def create_team(request, event_slug):
|
||||||
player.team = new
|
player.team = new
|
||||||
player.save()
|
player.save()
|
||||||
return redirect('events:event_info', event_slug=event_slug)
|
return redirect('events:event_info', event_slug=event_slug)
|
||||||
|
else:
|
||||||
|
return render(request, 'events/create_team.html', {'event' : ev, 'logged': True, 'wrongpwd': False, 'registered' : True, 'exist' : False})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def join_team(request, event_slug):
|
def join_team(request, event_slug):
|
||||||
response = redirect('events:join_team', event_slug=event_slug)
|
|
||||||
ev = get_object_or_404(Event, slug=event_slug)
|
ev = get_object_or_404(Event, slug=event_slug)
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if request.user.is_authenticated and ev.team_size > 1:
|
if request.user.is_authenticated and ev.team_size > 1:
|
||||||
|
@ -102,6 +102,8 @@ def team_info(request, name, event_slug):
|
||||||
def manage_team(request, event_slug):
|
def manage_team(request, event_slug):
|
||||||
event_info = get_object_or_404(Event, slug=event_slug)
|
event_info = get_object_or_404(Event, slug=event_slug)
|
||||||
player = EventPlayer.objects.get(user=request.user, event=event_info)
|
player = EventPlayer.objects.get(user=request.user, event=event_info)
|
||||||
|
if not player.team:
|
||||||
|
return render(request, 'events/create_team.html', {'event' : event_info, 'logged': True, 'wrongpwd': False, 'registered' : True, 'notexist' : False})
|
||||||
members = EventPlayer.objects.filter(team=player.team, event=event_info)
|
members = EventPlayer.objects.filter(team=player.team, event=event_info)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
Loading…
Reference in New Issue