Comment (by poleha):
Replying to [ticket:10506 mtredinnick]:
> When creating a subclass of a model with a default manager that has
`use_for_related_fields = True`, and if the subclass has no explicit
manager set, we should use the class of the parent's manager.
I don't think that child class should inherit parent class's manager since
documentation says it shouldn't:
https://docs.djangoproject.com/en/dev/topics/db/managers/#custom-managers-
and-model-inheritance
--
Ticket URL: <https://code.djangoproject.com/ticket/10506#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* keywords: => use_for_related_fields
--
Ticket URL: <https://code.djangoproject.com/ticket/10506#comment:7>
Comment (by loic):
[https://github.com/django/django/pull/6175#issuecomment-219451336 PR6175]
revamps inheritance and allows choosing the default manager explicitly
thought the `base_manager_name` meta.
--
Ticket URL: <https://code.djangoproject.com/ticket/10506#comment:8>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"ed0ff913c648b16c4471fc9a9441d1ee48cb5420" ed0ff91]:
{{{
#!CommitTicketReference repository=""
revision="ed0ff913c648b16c4471fc9a9441d1ee48cb5420"
Fixed #10506, #13793, #14891, #25201 -- Introduced new APIs to specify
models' default and base managers.
This deprecates use_for_related_fields.
Old API:
class CustomManager(models.Model):
use_for_related_fields = True
class Model(models.Model):
custom_manager = CustomManager()
New API:
class Model(models.Model):
custom_manager = CustomManager()
class Meta:
base_manager_name = 'custom_manager'
Refs #20932, #25897.
Thanks Carl Meyer for the guidance throughout this work.
Thanks Tim Graham for writing the docs.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/10506#comment:9>