这是我的表格。py:
from django import forms
from users.models import EnglishInterest, UserPlans
class CLSelectionForm(forms.Form):
plan_choices = UserPlans().get_plan_choices_active()
englishInterest_choices = EnglishInterest().get_english_interest_active()
useremail = forms.EmailField(widget=forms.HiddenInput(attrs={
'type': 'email'}))
coupon = forms.CharField(widget=forms.HiddenInput(attrs={
'type': 'email'}))
plans = forms.CharField(label='Plan Choice',
widget=forms.Select(choices=plan_choices, attrs={'id': 'plan_choice',
'class': 'fs-anim-lower fs-select-box', 'name': 'plan_choice'}))
englishInterest = forms.CharField(
label='English Interest', widget=forms.Select(choices=englishInterest_choices, attrs={'id':
'english_choice', 'class': 'fs-anim-lower fs-select-box', 'name': 'english_choice'}))
submitButton = forms.CharField(widget=forms.TextInput(
attrs={'type': 'submit', 'name': 'submit', 'id': 'fs-submit-button', 'class': 'fs-submit',
'value': 'Submit'}))
class Meta:
fields = ['useremail', 'coupon', 'plans', 'englishInterest']
我该如何使用包含选定属性的选项来呈现计划和englishInterest表单元素?