【发布时间】:2017-07-14 05:52:54
【问题描述】:
我在表单上有一个选择字段,我试图在下拉列表中显示所有相同颜色的汽车,所选颜色由用户输入字段定义
class car(forms.Form,email):
cars = forms.ModelChoiceField(
empty_label = "Current Cars",
queryset = Cars.objects.order_by('name').filter(color=color),
widget = Select(attrs={'class': 'span6 small-margin-top small-margin-bottom'}),
required=True
)
【问题讨论】: