【发布时间】:2016-11-11 07:05:36
【问题描述】:
installation page 看起来很简单。我安装了它,在设置中的INSTALLED_APPS 中添加了easy_select2,运行collectstatic,然后在我的表单中添加了这个:
from easy_select2 import Select2Multiple
# from django_select2 import forms as select2_forms
class LeadForm(forms.Form):
email = forms.CharField(max_length=100)
overseas_company = forms.MultipleChoiceField(
choices=countries,
label='Do you have any companies overseas and where?',
widget=Select2Multiple()
)
但它仍然表现得好像我什么都没做。我也试过django_select2,但它也不起作用,所以我一定是做错了Select2。
我尝试查看 HTTP 请求日志。仅启用 easy_select2 不会使模板请求 Select2 小部件运行所需的 jQuery/select2 js 文件。这是问题吗?但教程从未说过我必须向任何现有模板添加任何内容。
【问题讨论】: