刚接触 Django,我有一个名为曝光的应用程序:
我有一个表格:
usersegment = [['adminLevel0','Admin Level 0'],['adminLevel1','Admin Level 1'], ['adminLevel2','Admin Level 2']]
class ExposureForm(forms.Form):
adminLevel = forms.ChoiceField(widget=forms.RadioSelect(), choices=usersegment)
我有一个看法:
def exposure_form(request):
if request.method =='GET':
form = ExposureForm()
return render_to_response('exposure-export-wizard.html')
else:
html = '<html><body>Your request cannot be processed</body></html>'
return HttpResponse(html)
我有模板(不工作):
<form action="/exposure_form/" method="get">{% csrf_token %}
{{ form.as_p }}
问题是如何从模板访问我的单选按钮?