Django Student Portal - quiz app part 5 | 16

preview_player
Показать описание
In this playlist we are going to create a basic Student Portal or Learning portal using Django. This playlist is for beginners and everyone if you find this playlist useful consider sharing with your friends. If you have any comments or question leave in the comments section.

👨🏼‍💻GitHub repository:

💻Tutorial: Django 3.0 Tutorial Student - Learning Portal / website

🐍Django is a powerful web framework that you can use to build great web applications I highly recommend reading the documentation it has everything that you need.

❣️Thanks so much for watching and your support.

🔔Please consider subscribe to this channel for more Python content and more more.

___
📱Social stuff:
Рекомендации по теме
Комментарии
Автор

Hello Sir, Thanks Again for this wonderful sharing platform

ricoeva
Автор

It will be great to have your insight on the way to put a counter for the timer and the sum of each point for each question but maybe is done later

ricoeva
Автор

Also I think I corrected another bug which is on the sum of the score : I think in the for loop you added 2 times the scores
here is my correction I have just replaced the attempter.score += by = only.
for q, a in zip(questions, answers):
question = Question.objects.get(id=q)
answer = Answer.objects.get(id=a)
Attempt.objects.create(quiz=quiz, attempter=attempter, question=question, answer=answer)
if answer.is_correct == True:
earned_points += question.points
attempter.score = earned_points
attempter.save()
return redirect('index')

ricoeva
Автор

I've got a bug ( I think so), when you make the quiz several times, as we allowed it, when we go in attempt detail.html, we display all the answer of all the attempts. Is it possible to display only the attempts of the observed attempt id for the score ?
I tried different things as putting in the filter the id=attempt_id, but it is not working because maybe the filter is not allowing that? If you can help on that.
def AttemptDetail(request, course_id, module_id, quiz_id, attempt_id):
user = request.user
quiz = get_object_or_404(Quizzes, id=quiz_id)
attempts = Attempt.objects.filter(quiz=quiz, attempter__user=user, id=attempt_id)

context = {
'quiz': quiz,
'attempts':attempts,
'course_id': course_id,
'module_id': module_id,

}
return render(request, 'quiz/attemptdetail.html', context)

ricoeva