#26749: Different manager for _base_manager and related descriptors
-------------------------------------+-------------------------------------
     Reporter:  spectras             |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:  1.10
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  manager              |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by spectras):

 Could it be possible to clarify the intended use of `base_manager`? All
 over Django codebase, it's only used at 4 points:

 1. when finding out the list of related objects in the deletion collector
 2. when saving an existing model, the internal `_update` method is called
 on a queryset created by te base manager.
 3. when saving a newly created model, the internal `_insert` method is
 called on the base manager.
 4. in the `contrib.contenttypes` application, for ̀GenericForeignKey`.

 5. ''And well, since the changes of the linked commits, it's now also used
 for related fields, but hopefully that should be gone or overridable
 soon.''

 ----

 My understanding is use cases 1-3 are internal uses, and are the intended
 users of the base manager.

 On the other hand, use cases 4-5 expose the manager to user code, and
 should be overridable to offer custom behavior to user code without
 altering ORM internals.

 The change you suggest, with `related_manager_name`, seems in line with my
 understanding? If so, should `GenericForeignKey` use it as well?

 (by the way, in the
 
[https://docs.djangoproject.com/en/1.10/topics/db/managers/#django.db.models.Model._default_manager
 default manager documentation], I thinkg it should say
 `default_manager_name` instead of `base_manager_name`?)

--
Ticket URL: <https://code.djangoproject.com/ticket/26749#comment:4>
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/066.871f88612ce003590aa0504ef0cfca88%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to