#30688 closed Cleanup/optimization (fixed)
Clarify docs for Options.base_manager_name.
Reported by: | Anton Gilgur | Owned by: | Anton Gilgur |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
There is currently no documentation in topics or the reference about how specifically to use Meta.base_manager_name
and I think an example could alleviate the confusion this causes.
I had some trouble in a library I maintain (https://github.com/agilgur5/django-serializable-model/issues/4#issuecomment-519338032), where I mistakenly thought that base_manager_name
should be set to, literally the name of the manager, as in the string equivalent to the name of the class of the manager (in my case, 'SerializableManager'
), similar to how one may reference models by string.
Through finding some examples online like https://stackoverflow.com/a/48124863/3431180, I realized it's supposed to be the name of the attribute on the current class that contains the instance of the manager (in my case, 'objects'
).
An example would really clear things up very concisely.
Change History (4)
comment:1 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 5 years ago
Patch needs improvement: | set |
---|---|
Summary: | Add example usage for Meta.base_manager_name → Clarify docs for Options.base_manager_name. |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
Version: | 2.2 → master |
Thanks for this! Yes, but as per comment on PR, I think a clarification of the Options.base_manager_name description is what's needed.
Currently, "The name of the manager..." is ambiguous as you say. Narrowing that to "The attribute name...", adding perhaps "... for example
'objects'
..." if we think that's clearer should be enough.