【发布时间】:2020-09-15 08:10:49
【问题描述】:
我想刷新 html 页面中的特定部分(包含表单),而不是 Django 模板中的整个页面。当用户提交重定向到下一个问题的表单时,表单包含问题和选择。(base.html 包含我的脚本用于创建倒计时)
question_details.html
{% extends 'app/base.html' %}
{% block content %}
<div>
<h2>score -{{user.userextend.score}}</h2>
<form action="{% url 'app:detail' quiz_id=que.quiz.id question_id=que.id %}" method="post" id="user_form">
{% csrf_token %}
{% for choice in que.answer_set.all %}
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
<label for="choice{{ forloop.counter }}">{{ choice.answer }}</label><br>
{% endfor %}
<input type="submit" value="Next">
</form>
</div>
{% endblock %}
【问题讨论】:
-
stackoverflow.com/questions/21133135/… 你可能会在这里找到答案
标签: javascript html jquery django django-templates