我想为 M2M 使用垂直复选框。这是一个代码示例:
class Contact(models.Model):
...
groups = models.ManyToManyField (
Group,
related_name = "contacts",
verbose_name = _("Groups"),
)
...
class Group (models.Model):
name = models.CharField (
unique = True,
max_length = 100,
db_index = True,
)
class ContactAdminForm(forms.ModelForm):
class Meta:
model = Contact
radio_fields = {"groups": admin.VERTICAL} # only for foreignkey or for choices
有什么帮助吗?
谢谢,V。