表格.py
Date_Format = (
('0', ' dd / mm / yyyy'),
('1', 'mm / dd / yyyy'),
)
Time_Format = (
('0', ' 12 hour AM / PM '),
('1', ' 24 hour '),
)
class SettingsForm(forms.ModelForm):
date_format = forms.ChoiceField(widget=forms.RadioSelect(), choices=Date_Format)
time_format = forms.ChoiceField(widget=forms.RadioSelect(), choices=Time_Format)
模板.py
更新:
{% for radio in SettingsForm.date_format %}
{{ radio.choice_label }}
<div class="select">{{ radio.tag }}</div>
{% endfor %}
上面的表单在无序列表中呈现单选按钮,但我希望没有无序列表。我该怎么做?