Document that get_next/previous_by_FOO uses default manager
|Reported by:||Jani Tiainen||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)
comment:1 Changed 4 years ago by
|Component:||Database layer (models, ORM) → Documentation|
|Summary:||get_next/previous_by_FOO doesn't work properly with multiple managers → Document that get_next/previous_by_FOO uses default manager|
|Triage Stage:||Unreviewed → Accepted|
|Type:||Uncategorized → Cleanup/optimization|