2017-05-09 54 views
0

的選擇的組合框depenedent我有我的形式,其他組合框 的forms.pyDjango的 - 如何讓其他組合框

v_type = forms.ChoiceField(choices=VEHICLE_TYPE,widget=forms.Select(attrs={'class':'form-control'})) 
v_sub_type = forms.ChoiceField(choices=VEHICLE_SOUS_TYPE,widget=forms.Select(attrs={'class':'form-control'})) 
源代碼的選擇有關的第二個下拉框2名下拉列表

的coices的數據只是到變量列表

enter image description here

回答

0

您可以使用Ajax調用來填充基於v_type

的onchange事件的v_sub_type選項
相關問題