【发布时间】:2020-11-12 16:41:18
【问题描述】:
我正在制作一个测验应用程序
这是我的 html 文件
{% for question in questions %}
<p>Q){{question.name}}</p>
<input type="radio" value="1" name="{{question.id}}">{{question.option1}}
<input type="radio" value="2" name="{{question.id}}">{{question.option2}}
<input type="radio" value="3" name="{{question.id}}">{{question.option3}}
<input type="radio" value="4" name="{{question.id}}">{{question.option4}}
{% endfor %}
在我的数据库中,我的正确答案存储名称为正确选项
这可以是检查分数的代码
{% if question.correct_option == ? %}
{% score=1 %}
{% endif %}
为了写这篇文章,我需要找出用户选择了什么 '?' 应该写什么
【问题讨论】:
标签: html django django-models django-forms django-templates