Django实现
Django materialize
所以我的 forms.py
:
auto_current_type = forms.ModelMultipleChoiceField(label="Авто:", queryset=Auto_current_type.objects.all(),
widget=forms.CheckboxSelectMultiple())
我的模板:
<div class="row">
<form class="col s6 offset-s3 l6 offset-l3 m6 offset-m3" method="post">
{% form %}
{% endform %}
<button class="btn waves-effect waves-light" type="submit" name="action">Поиск
</button>
</form>
</div>
但它看起来像:
如您所见,有车型名称,在下方您可以看到具有相同车型名称的复选框。但是复选框不起作用。有帮助吗?
我找到了解决办法
here
我刚刚添加 {{ form|materialize }}
并且它开始工作了
所以我的 forms.py
:
auto_current_type = forms.ModelMultipleChoiceField(label="Авто:", queryset=Auto_current_type.objects.all(),
widget=forms.CheckboxSelectMultiple())
我的模板:
<div class="row">
<form class="col s6 offset-s3 l6 offset-l3 m6 offset-m3" method="post">
{% form %}
{% endform %}
<button class="btn waves-effect waves-light" type="submit" name="action">Поиск
</button>
</form>
</div>
但它看起来像:
如您所见,有车型名称,在下方您可以看到具有相同车型名称的复选框。但是复选框不起作用。有帮助吗?
我找到了解决办法 here
我刚刚添加 {{ form|materialize }}
并且它开始工作了