Djangoselect2:如何将函数名添加到不带引号的templateSelection选项?

2024-10-02 00:20:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用select2提供的templateSelection选项。在

将其添加到“选择选项”列表时,将使用引号呈现它。在

invited_user=forms.ModelMultipleChoiceField(queryset=User.objects.all(),
       required=True, 
       widget=Select2MultipleWidget(select2_options={
            'templateSelection': 'testformation',
            }))

这将返回:

^{pr2}$

使用引号时,它不会被检测为js函数,因此它无法工作。在

有人能帮我把这个弄起来吗?在


Tags: true列表objects选项requiredformsall引号

热门问题