我有以下模板代码,目前我正在获取循环计数器作为我的表单集的标签。我怎样才能得到数组'月'的元素(例如month.counter,其中计数器是循环)作为我的标签?我试过 {{month.forloop.counter}} 但没有奏效
<html>
<head>
<title>Actuals</title>
</head>
<body>
<h1>Actuals Data</h1>
<h2>Your Account Number is : {{ Account_Number }}</h2>
<h2>You Chose {{ Year }} {{month}} as period.</h2>
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }}below.</p>
{% endif %}
<form action="." >
{{ formset.management_form }}
<table>
{% for form in formset %}
{{form.id}}
<div class="field">
{{ form.Value.errors }}
<label for="id_Value">{{months}}.{{forloop.counter}}</label>
{{ form.Value }}
</div>
{% endfor %}
</table>
</form>
</body>
</html>