Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def TestResult(request):
- text = Text.objects.all().order_by("-id")[0:1].get()
- this_week = text.week_number
- qustions = TestQuestion.objects.filter(week_number=this_week)
- ans_dict = {}
- for question in qustions:
- answers = TestAnswer.objects.filter(question=question)
- ans_dict[question] = []
- for ans in answers:
- ans_dict[question].append(ans)
- data = {
- 'ans_dict': ans_dict,
- }
- return render(request, 'testresult.html', data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement