#14891: use_for_related_fields=False is not honored by reverse FK or M2M related
managers
-------------------------------------+-------------------------------------
     Reporter:  sdksho@…             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  Manager              |             Triage Stage:  Accepted
  ManyToManyField                    |
  use_for_related_fields             |
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by loic):

 I like the `(manager='objects', related_manager='related')` API since it
 allows fine grained control over the relation manager as expected by the
 relational field. It's in the same spirit as
 https://docs.djangoproject.com/en/1.9/topics/db/queries/#using-a-custom-
 reverse-manager which allows controlling the reverse manager per query per
 relational field.

 But I also see merit in allowing the model to say which manager should be
 used by default by relations. My work on #20932 can easily be extended to
 support a `related_manager_name` meta.

 It would work as follows:
 {{{
 class Model(models.Model):
     objects = models.Manager()
     custom_manager = CustomManager()

     class Meta:
         related_manager_name = 'custom_manager'
 }}}

 PR https://github.com/django/django/pull/6175 shows a working
 implementation + deprecation.

--
Ticket URL: <https://code.djangoproject.com/ticket/14891#comment:28>
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/076.dbee7d6dfd09170abf94e9f33797fac2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to