#26643: AlterModelManagers migration is generated for all Models with custom
Managers pointing to the default Django Manager
---------------------------------+------------------------------------
     Reporter:  cybojenix        |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Migrations       |                  Version:  master
     Severity:  Release blocker  |               Resolution:
     Keywords:  1.10             |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by MarkusH):

 * type:  Cleanup/optimization => Bug
 * component:  Documentation => Migrations
 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


Comment:

 I briefly talked to cybojenix on IRC, this sounds like a bug to me.

 '''Seen behavior:'''

 {{{#!python
 class CustomManager(models.Manager):
     pass

 class Model(models.Model):
     objects = CustomManager()
 }}}

 This creates a migration with a default manager though no manager is
 marked with `use_in_migrations = True`.

 '''Expected behavior:'''

 Unless there's >=1 manager with `use_in_migrations = True` don't actually
 ''add'' the manager to the state but only ''consider'' it was added. This
 prevents unnecessary migrations that don't add anything useful.
 Essentially, a ModelState with an empty `managers` dict is the same as
 defining a model without setting an explicit manager (neither default nor
 a custom one).

 ----

 Marked as release blocker due to unexpected creation of migrations. I'd
 have wanted this fixed when I'd have noticed it while reviewing
 https://github.com/django/django/pull/6175

--
Ticket URL: <https://code.djangoproject.com/ticket/26643#comment:5>
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/067.56e1f7acb614955c63fcd59a7956bab2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to