本文介绍了更好的ArrayField管理小部件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以使ArrayField的管理小部件允许添加和删除对象?似乎默认情况下,它只显示一个文本字段,并使用逗号分隔值。
Is there any way to make ArrayField's admin widget allow adding and deleting objects? It seems that by default, it is instead displayed just a text field, and uses comma separation for its values.
除了不方便之外,在数组的基字段是Char / TextField的情况下,AFAICT不允许在任何文本中包含逗号
Besides being inconvenient, AFAICT in the case the base field of the array is a Char/TextField, this doesn't allow any way of including commas in any of the texts in the array.
推荐答案
对于OP或其他正在寻找的人,在这些有用的地方之间,您应该会做得很好:
For OP, or anyone out there looking, between these helpful bits you should be good to go:
- 1. Extending
SelectMultiple
orCheckboxSelectMultiple
widget to parsearrayfield
and - 2. Creating or extending admin form to display the
arrayfield
using the widget above
这篇关于更好的ArrayField管理小部件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!