#22435: Adding a ManyToManyField and running makemigrations prompts for a 
default
-------------------------------+--------------------
     Reporter:  andrewsg       |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  master
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Adding a ManyToManyField to an existing model prompts the user as so:

 {{{
 You are trying to add a non-nullable field 'authors' to post without a
 default;
 we can't do that (the database needs something to populate existing rows).
 Please select a fix:
  1) Provide a one-off default now (will be set on all existing rows)
  2) Quit, and let me add a default in models.py
 Select an option:
 }}}

 Since there is no way to specify a default for an M2M field in the
 interactive process, this makes it impossible to add M2M fields.

 The workaround is to cancel and add `null=True` to the field definition.
 But `null=True` does not apply to `ManyToManyField`, so this should be
 unnecessary.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22435>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.61039779e1d53b171e49c311cb6849d1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to