1
如何從模板中刪除標籤MultipleChoiceField?如何去除標籤?
forms.py:
class RequirementAddForm(forms.ModelForm):
symbol = forms.MultipleChoiceField(required=False, widget=forms.CheckboxSelectMultiple, choices=REQUIREMENTS_CHOICES,)
class Meta:
model = Requirement
fields = ('symbol',)
template.html:
{{ form }}
謝謝!在開始時我使用了'self.fields ['symbol']。label = None',但它不起作用。然後,在你的答案之後,我使用'self.fields ['field']。label =''',它適用於我。 –