Templates fuer Fragen

This commit is contained in:
juhnsa
2025-03-16 17:08:38 +01:00
parent f18ed83f9d
commit d2375e136a
6 changed files with 144 additions and 5 deletions

View File

@@ -1,9 +1,11 @@
from django.shortcuts import render
from django.shortcuts import render, redirect, get_object_or_404, reverse
from play.models import QuizGame, QuizGameParticipant
from library.models import QivipQuiz
from library.models import QivipQuiz, QivipQuestion
from django.http import HttpResponseRedirect
import json
# Create your views here.
def lobby(request, join_code):
if not "participant_id" in request.COOKIES:
@@ -57,4 +59,28 @@ def join_game(request):
except QuizGame.DoesNotExist:
# TODO: Mit message eine Fehlermeldung weitergeben (und im entsprechenden Template Designen)
pass
return render(request, 'play/join_game.html')
return render(request, 'play/join_game.html')
def question(request, join_code, question_id):
question = get_object_or_404(QivipQuestion, pk=question_id)
if question.data:
question.data = json.loads(question.data)
context = {
'question': question,
}
return render(request, 'play/game/question_host.html', {'question': question, 'debug': "debug"})
def question_participant(request, join_code, question_id):
question = get_object_or_404(QivipQuestion, pk=question_id)
if question.data:
question.data = json.loads(question.data)
context = {
'question': question,
}
return render(request, 'play/game/question_participant.html', {'question': question, 'debug': "debug"})