Re: [Django] #27664: contribute_to_class is called with wrong model class

2016-12-29 Thread Django
#27664: contribute_to_class is called with wrong model class
-+-
 Reporter:  Johannes Hoppe   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * cc: Loic Bistuer (added)


Comment:

 This changed in 3a47d42fa33012b2156bf04058d933df6b3082d2 - Fixed #20932,
 #25897 -- Streamlined manager inheritance.

 I'm uncertain if the new behavior is intended or if it needs clarification
 in the release notes, however, as far as I know `contribute_to_class()` is
 a private API so backwards compatibility and documentation changes there
 isn't a high priority.

--
Ticket URL: 
Django 
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.3fd423e76cb556bc0949041b8578aab2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27664: contribute_to_class is called with wrong model class

2016-12-29 Thread Django
#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: 
Django 
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.