我希望我错了,但在我看来,没有help_text
ManyToManyField 的唯一方法是为表单编写一个__init__
方法并覆盖self.fields[fieldname].help_text
。这真的是唯一的方法吗?我更喜欢使用CheckboxSelectMultple
小部件,所以我真的必须__init__
为任何使用ManyToManyField
?
class ManyToManyField(RelatedField, Field):
description = _("Many-to-many relationship")
def __init__(self, to, **kwargs):
#some other stuff
msg = _('Hold down "Control", or "Command" on a Mac, to select more than one.')
self.help_text = string_concat(self.help_text, ' ', msg)