diff --git a/core/play/urls.py b/core/play/urls.py index 72f8362..444ac54 100644 --- a/core/play/urls.py +++ b/core/play/urls.py @@ -6,4 +6,5 @@ app_name = 'play' urlpatterns = [ path('lobby/', views.lobby, name='lobby'), path('join', views.join_game, name='join_game'), + path('participant', views.create_participant, name='create_participant'), ] \ No newline at end of file diff --git a/core/play/views.py b/core/play/views.py index 69e57fc..055a1ad 100644 --- a/core/play/views.py +++ b/core/play/views.py @@ -2,12 +2,22 @@ from django.shortcuts import render from django.shortcuts import render, redirect, get_object_or_404 from play.models import QuizGame from library.models import QivipQuiz +from django.http import HttpResponse # Create your views here. def lobby(request, join_code): quiz_game = get_object_or_404(QuizGame, join_code=join_code) return render(request, 'play/lobby.html', {'debug': "test"}) +def create_participant(request): + join_code = request.GET.get('join_code') + if "participant_id" in request.COOKIES: + return redirect('play:lobby', join_code=join_code) + if request.method == 'POST': + display_name = request.POST.get('username') + join_code = request.POST.get('join_code') + return render('play/initialize_participant.html', {'join_code': join_code}) + def join_game(request): if request.method == 'POST': join_code = request.POST.get('game_code')