Created
July 11, 2019 04:47
-
-
Save ihfazhillah/0c4087315728faa92544c2c44f2ef1e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def detail_quiz(request, pk): | |
quiz = get_object_or_404(Quiz, pk=pk) | |
context = { | |
'quiz': quiz | |
} | |
allowed_see_questions = any([ | |
request.user == quiz.created_by, | |
request.user in quiz.students.all() | |
]) | |
if allowed_see_questions: | |
context['questions'] = Question.objects.filter(quiz=quiz) | |
return render_template(request, templatename, context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment