#20932: Issues with model Manager and inheritance.
-------------------------------------+-------------------------------------
Reporter: loic84 | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by loic):
Replying to [comment:8 ar45]:
> After the deprecation period, the class setup in `ModelBase` will not
find any existing managers -- so `new_class._prepare()` which calls
`ensure_default_manager()` will create an implicit manager. So
`MessyBachelorParty` will get an implicit `objects = models.Manager()`
That doesn't match my observations, `MessyBachelorParty.objects` raises an
attribute error when `ManagerDescriptor.__get__()` raises an
`AttributeError`. `MessyBachelorParty._default_manager` is set (and yields
the right model type), I haven't had time to investigate fully but I
guess it trips
[https://github.com/django/django/blob/10a162809fa4de3a56bb7f2d3cb12b6b82a6f826/django/db/models/manager.py#L21
this condition].
--
Ticket URL: <https://code.djangoproject.com/ticket/20932#comment:9>
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/064.68482e1eb71d07ff664ffc1a4f5f71f8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.