Created
July 11, 2019 04:46
-
-
Save ihfazhillah/f07d9ef8a4cfb7e0c07e32cffc936684 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
# views.py | |
def detail_quiz(request, pk): | |
quiz = get_object_or_404(Quiz, pk=pk) | |
return render_template(request, templatename, {'quiz': quix}) | |
# in template | |
{# to show questions #} | |
{% if request.user == quiz.created_by or request.user in quiz.students.all() %} | |
{% for question in quiz.questions.all() %} | |
{# show the questions %} | |
{% endfor %} | |
{% else %} | |
Only Registered user can see the questions | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment