Skip to content

Instantly share code, notes, and snippets.

@alexlopes
Last active December 9, 2015 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexlopes/791aa141d7c35f92392f to your computer and use it in GitHub Desktop.
Save alexlopes/791aa141d7c35f92392f to your computer and use it in GitHub Desktop.
Django Tricks

#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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment