【发布时间】:2010-07-13 22:50:14
【问题描述】:
我希望我错了,但在我看来,让 ManyToManyField 没有 help_text 的唯一方法是为表单编写 __init__ 方法并覆盖 self.fields[fieldname].help_text。这真的是唯一的方法吗?我更喜欢使用CheckboxSelectMultple 小部件,所以我真的必须为任何使用ManyToManyField 的表单定义一个__init__ 方法吗?
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)
【问题讨论】:
标签: python django django-forms manytomanyfield