How do I make many-to-many field optional in Django?
If you want to be able to specify ManyToMany relation without making it required just use blank=True
:
class Group(models.Model): ... events = models.ManyToManyField(Event, blank=True)
If you want to be able to specify ManyToMany relation without making it required just use blank=True
:
class Group(models.Model): ... events = models.ManyToManyField(Event, blank=True)