Document implications about multiple managers and the _default_manager
codingjoe opened this issue · comments
Hi there,
As discussed during the DjangoCon, here my remarks as a proper ticket.
Currently, the README-file suggest to the scopes manager is set as the objects
on the models.
Yet, some mechanisms like reverse relations use the _default_manager
. The default manager is the first manager defined on an object. If there only is one, you'd be safe, there are many, it does make sense to make sure the default manger is a scopes one. That can be done by setting Meta.default_manager_name
.
I would suggest the documentation should reflect that bit any maybe suggest to always explicitly set default_manager_name
to the scopes manager.
Best,
Joe
BTW, cool project, I run some multi tenant projects too, this will come in handy.
I'm all in for adding a warning to the doc, but I'm not sure setting default_manager_name
is a good idea – Django docs very loudly warn not to do that with a manager that filters things.
I'd rather include a warning in the docs that explains that this manager needs to be the first manager to guarantee working behaviour.
I know this sounds brittle, but that's on Django, not on this library ("first manager is special" is surprising and uncomfortable imo, but that's a very different problem). Just highlighting this issue ought to help a lot.
Sounds good to me, a simple one liner should do fine.