Document that get_next/previous_by_FOO uses default manager
|Reported by:||jtiai||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Model methods get_next_by_FOO() and get_previous_by_FOO() doesn't honor original manager used but uses always default manager (first manager declared on a model).
This might potentially return incorrect data, for example in cases where softdelete is used. Default manager would return all objects but normally user uses manager that returns only non-deleted objects. In that case get_next|pervious_by_FOO would return incorrect data.
Possible workaround would be using proxy models.
Change History (11)
Changed 14 months ago by jtiai
comment:1 Changed 14 months ago by carljm
- Component changed from Database layer (models, ORM) to Documentation
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Summary changed from get_next/previous_by_FOO doesn't work properly with multiple managers to Document that get_next/previous_by_FOO uses default manager
- Triage Stage changed from Unreviewed to Accepted
- Type changed from Uncategorized to Cleanup/optimization
Changed 14 months ago by nkryptic
comment:8 Changed 10 months ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from new to closed