我有一个带有CheckboxSelectMultiple部件的2 MultipleChoiceField的表单。
当在模板中呈现时,复选框在每个选项的左侧都有一个“项目符号”。
我认为这与复选框渲染有关,但我不确定如何删除项目符号?
反馈非常感谢。
表单
class GameScheduleForm(forms.Form):
weight_training_days = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple,
choices=(
(0, "MONDAY"),
(1, "TUESDAY"),
(2, "WEDNESDAY"),
(3, "THURSDAY"),
(4, "FRIDAY"),
(5, "SATURDAY"),
(6, "SUNDAY"),
),
)
cardio_training_days = forms.ChoiceField(widget=forms.CheckboxSelectMultiple,
choices=(
(0, "MONDAY"),
(1, "TUESDAY"),
(2, "WEDNESDAY"),
(3, "THURSDAY"),
(4, "FRIDAY"),
(5, "SATURDAY"),
(6, "SUNDAY"),
),
)
字符串
模板
{% extends "fitgames/fitgames_base.html" %}
{% block content %}
<div class="row-fluid">
<div class="well game span4 offset4">
<div class="row-fluid">
<h4 class="text-center">Total Body HIT</h4>
<p class="text-center">Select the days you can workout</p>
</div>
<div class="row-fluid">
<form method="post" action="{% url 'game_setup2_schedule' %}"> {% csrf_token %}
<div><strong>Select 3 Weight Training Days</strong></div>
<div>{{ form.weight_training_days}}</div>
<div><strong>Select 3 Cardio Days</strong></div>
<div>{{ form.cardio_training_days }}</div>
<div><button class="btn btn-primary btn-large" type="submit"> Next</button></div>
</form>
</div>
</div>
</div>
型
{% endblock %}
3条答案
按热度按时间ffvjumwh1#
呈现forms.CheckboxSelectMultiple时,它呈现在ul标记中。你需要做的是将以下内容添加到CSS中(根据需要使其更具体地适用于该表单):
字符串
jvlzgdj92#
这就去掉了项目符号,而不添加css。:)
字符串
e37o9pze3#
我发现在form类中定义最简单
字符串