Move `Manager.raw()` and `Manager._insert()` to the QuerySet class.
|Reported by:||loic84||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
After the introduction of #20625, most methods that involve a DB query have been removed from
Manager and are automatically proxied to
_insert() remain. After discussion with @akaariai on IRC we came to the conclusion that it would make sense to move these to the
QuerySet class as well.
The previous goal was for
QuerySet to focus on retrieval, but this has somewhat failed as most methods that could belong to
create()) already live on the
QuerySet class. The introduction of hybrid methods like
update_or_create() also demonstrates that the distinction between the different kinds of queries is not obvious to make.
If this ticket is accepted, the new objective would be defined as follows:
- Anything "query" belongs to
Manageris responsible for the integration between a
Managerworks as a hook to pre/post-process or even replace
QuerySetmethods when needed. (See current implementation of
Change History (4)
comment:1 Changed 3 years ago by
|Patch needs improvement:||unset|