我正在为我的 m2m 和外键字段使用 ajax_select,它工作正常,但它没有呈现该字段的默认值,它正在呈现空值("|"
)。我没有在我的管理面板中使用 ajax_select,所以当我在管理面板中打开该表单时,字段已经具有默认值。这意味着它们在默认值中没有问题,但在 ajax_select 字段中。
它现在正在呈现什么:
<input type="hidden" name="colours" id="id_colours" value="|" data-ajax-select="autocompleteselectmultiple" data-plugin-options="{"source": "/ajax_select/ajax_lookup/colours", "html": true}" data-changed="true">
我想要的是:
<input type="hidden" name="colours" id="id_colours" value="|8|" data-ajax-select="autocompleteselectmultiple" data-plugin-options="{"source": "/ajax_select/ajax_lookup/colours", "html": true}" data-changed="true">
如果至少在 中初始化默认值name=colour
,我可以显示默认值为 的帮助文本White
。
正如我在 ajax_select 的文档中搜索但没有找到与它相关的,有谁知道如何在 ajax_select 字段中呈现默认值。
这个问题是只发生在我身上还是 ajax_select 没有这个默认值功能?