我正在尝试停用表单的“ charfield”字段,可以使用bootstrapa类来做到这一点吗?
如果是这样,如何在提供它的html标签中正确输入我的“ form.compartment”字段,或者当我使用“ modelformset_factory”时视图应该是什么样。
html文件
var subjects = ["Physics", "English", "History"];
var learner = ["Physics", "History", "Spanish"];
// Loop over the subjects the learner wants to learn
learner.forEach(function(subjectToLearn){
// Check if the desired subject is taught
if(subjects.indexOf(subjectToLearn) > -1){
console.log(subjectToLearn + " is taught.");
} else {
console.log(subjectToLearn + " is not taught.");
}
});
views.py
<form action="." method="post">
{% csrf_token %}
{{ time_edit_form.management_form }}
{% for form in time_edit_form %}
{{ form.id }}
<ul>
<li>{{ form.free_or_no|as_crispy_field }}</li>
<li>{{ form.compartment|as_crispy_field }}</li>
</ul>
{% endfor %}
<button type="submit" class="btn btn-block btn-primary"> Zapisz</button>
</form>