django-suit

Select all choices in a ManyToManyField by default

坚强是说给别人听的谎言 提交于 2019-12-11 04:08:46
问题 Is it possible somehow by default to choose all the choices within a select multiple generated by ManyToManyField in Django? All new items that are added should have all choices selected upfront in the view (also when adding new items of AnotherEntity ). class AnotherEntity(models.Model): name = models.CharField() class SomeEntity(models.Model): anotherEntity = models.ManyToManyField(AnotherEntity) In the example above i wish to have all choices in anotherEntity selected in all new items. 回答1