0
我想爲M2M使用垂直複選框。這裏是一個代碼示例:django表單 - 爲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
對此有何幫助?
感謝, 五