Templates fuer Fragen
This commit is contained in:
@@ -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"})
|
||||
Reference in New Issue
Block a user