Make setup_joins() the primary API for join generation
|Reported by:||Anssi Kääriäinen||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently the ORM has two different code paths for generating joins. First, there is setup_joins() which uses internally names_to_path() which again uses get_path_info(). However some other parts of the ORM use directly field's get_joining_columns() (select_related descent in the compiler, joining of parent models to the query).
The idea is to use setup_joins() in all cases. This would unify the way joins are generated and thus ensure things work even if one needs to have weird definitions of get_path_info() and get_joining_columns() (needed for example by GenericRelation which works backwards to normal join fields).