﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26749	Preserve behavior of use_for_related_field during deprecation	Julien Hartmann	nobody	"I am in the process of testing Django 1.10 and upgrading the third-party package I maintain, django-hvad.

This ticket is related to the two following commits:
* '''Streamlined manager inheritance.:''' https://github.com/django/django/commit/3a47d42fa33012b2156bf04058d933df6b3082d2
* '''Introduced new APIs to specify models' default and base managers:''' https://github.com/django/django/commit/ed0ff913c648b16c4471fc9a9441d1ee48cb5420

The issue I have with the way inheritance and customization now works is it is very hard to have a different manager as the `base_manager` and the one used for related field descriptors.

''Why the need?''

Django-hvad is one of the modules that change the default querysets. It does it by replacing the default manager with one that brings extra features. Namely, automatic joining onto a translations model.

Having those features available on related fields is essential to provide a consistent interface, and after years of having it, it is now essential to backward compatibility as well.

It does not break the basic rule of “a base manager must not hide objects”, as it merely adds automatic `select_related()` rules and `iterator()` encapsulation.

Yet, those extra features cannot be on the `base_manager`, due to the way ORM internals use it (for instance, triggering additional joins on a delete would not work).

''Why the ticket?''

Up to Django 1.9, this was possible using `use_for_related_fields = True`, and fixing the `_base_manager` in the `class_prepared` hook. Not clean but workable.

With the new API though, all the manager machinery uses property descriptors on the `Options` class, making it difficult and fragile to override. And at the same time, using `use_for_related_fields` got deprecated, which means there is no option to use '''a different manager as the base manager and as the related field descriptor's manager''' anymore.

Unless there is another way to do this?"	Cleanup/optimization	closed	Database layer (models, ORM)	1.10	Normal	fixed	manager	Loic Bistuer Shai Berger	Ready for checkin	1	0	0	0	0	0
