#26881: Crash when creating migrations with managers having 
use_in_migrations=True
-------------------------------------------+------------------------
               Reporter:  claudep          |          Owner:  nobody
                   Type:  Bug              |         Status:  new
              Component:  Migrations       |        Version:  1.10
               Severity:  Release blocker  |       Keywords:
           Triage Stage:  Unreviewed       |      Has patch:  0
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+------------------------
 Considering this model layout:
 {{{
 from django.db import models


 class PersonManager(models.Manager):
     use_in_migrations = True


 class Person(models.Model):
     name = models.CharField(max_length=10)

     objects = PersonManager()

     class Meta:
         abstract = True


 class BossManager(PersonManager):
     use_in_migrations = True


 class Boss(Person):
     objects = BossManager()
 }}}

 Django 1.10 crashes when calling `makemigrations`:
 {{{
   ...
   File "/home/claude/virtualenvs/djangogit/local/lib/python2.7/site-
 packages/django/db/migrations/autodetector.py", line 172, in
 _detect_changes
     self.generate_created_models()
   File "/home/claude/virtualenvs/djangogit/local/lib/python2.7/site-
 packages/django/db/migrations/autodetector.py", line 553, in
 generate_created_models
     managers=model_state.managers,
   File "/home/claude/virtualenvs/djangogit/local/lib/python2.7/site-
 packages/django/db/migrations/operations/models.py", line 64, in __init__
     _check_for_duplicates('managers', (name for name, _ in self.managers))
   File "/home/claude/virtualenvs/djangogit/local/lib/python2.7/site-
 packages/django/db/migrations/operations/models.py", line 20, in
 _check_for_duplicates
     "Found duplicate value %s in CreateModel %s argument." % (val,
 arg_name)
 ValueError: Found duplicate value objects in CreateModel managers
 argument.
 }}}

 while Django 1.9 creates the migration without problem.

--
Ticket URL: <https://code.djangoproject.com/ticket/26881>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.ffaf15081c9eedc523a18edf9e3f96e3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to