You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
851 B
24 lines
851 B
from django.http import HttpResponse |
|
from django.template import loader |
|
from .models import Question, Categorie |
|
from random import shuffle |
|
|
|
def quiz_main(request): |
|
categories_list = Categorie.objects.all() |
|
template = loader.get_template('quiz/quiz_main.html') |
|
context = { |
|
'categories_list': categories_list, |
|
'favicon':'question-circle-solid.svg' |
|
} |
|
return HttpResponse(template.render(context, request)) |
|
|
|
def quiz_categorie(request, categorie_id): |
|
question_list = Question.objects.all().filter(categorie_question=categorie_id) |
|
random_list = list(question_list) |
|
shuffle(random_list) |
|
template = loader.get_template('quiz/quiz.html') |
|
context = { |
|
'question_list': random_list, |
|
'favicon':'question-circle-solid.svg' |
|
} |
|
return HttpResponse(template.render(context, request))
|
|
|