#27664: contribute_to_class is called with wrong model class
-------------------------------------+-------------------------------------
               Reporter:  Johannes   |          Owner:  nobody
  Hoppe                              |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  1.10
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Since 1.10 `Manager.contribute_to_class` gets called with the model on
 which the manager is defined instead of the subclass.
 Before that it used to be called for all sub models with the proper class.

 You can easily reproduce that by running this in both version 1.9 and
 1.10. `model` will be different.

 {{{
 class MyManager(models.Manager):

      def contribute_to_class(self, model, name):
          super().contribute_to_class(model, name)
          print(model)

 class AbstractModel(models.Model):
     objects = MyManager()
     class Meta:
         abstract = True

 class ContcreteModel(AbstractModel):
     pass
 }}}

 This change has not been documented in the release notes and also seems
 counter intuitive. Contribute to class should be called with the concrete
 model.

--
Ticket URL: <https://code.djangoproject.com/ticket/27664>
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/052.fb943aa16f2d7b665ce3960715177884%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to