vault backup: 2025-12-26 02:09:22
All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 2m29s
All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 2m29s
This commit is contained in:
18
stroma/quiz/views/index_view.py
Normal file
18
stroma/quiz/views/index_view.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user