当前位置:优学网  >  在线题库

Django表单单选按钮

发表时间:2022-07-28 00:49:33 阅读:75

I had made a form using django forms and call it to a template but while I select a radio button it won't pick what's the solution

''' html section '''

                    <div class="form-row p-t-20">

                        <label class="label label--block">Gender</label>
                            {% for radio in form.Gender %}

                            <div class="p-t-15">
                            <label class="radio-container">
                                {{radio}}
                                <input type="radio" name="gender">
                                <span class="checkmark"></span>

                            </label>
                        </div>      

''' forms section '''

Gender = forms.ChoiceField(choices=GenderChoice,widget=forms.RadioSelect(attrs={'class':'form-check form-check-inline'}))
🎖️ 优质答案
相关问题