All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 2m29s
19 lines
639 B
Python
19 lines
639 B
Python
from django.shortcuts import render
|
|
from quiz.models import QuizSession, QuizResult, Question
|
|
from quiz.forms import CreateQuizForm
|
|
|
|
|
|
def index(request):
|
|
active_sessions = QuizSession.objects.filter(user=request.quiz_user, is_active=True)
|
|
total_questions = Question.objects.count()
|
|
answered_count = QuizResult.objects.filter(user=request.quiz_user).count()
|
|
|
|
context = {
|
|
'total_questions': total_questions,
|
|
'answered_count': answered_count,
|
|
'active_sessions': active_sessions,
|
|
'form': CreateQuizForm(), # Include form on landing page
|
|
}
|
|
return render(request, 'index.html', context)
|
|
|