Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#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 Anton Gilgur, 5 years ago

Owner: changed from nobody to Anton Gilgur
Status: newassigned

comment:2 by Carlton Gibson, 5 years ago

Patch needs improvement: set
Summary: Add example usage for Meta.base_manager_nameClarify docs for Options.base_manager_name.
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization
Version: 2.2master

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.

comment:3 by Carlton Gibson <carlton.gibson@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 514efa31:

Fixed #30688 -- Clarified base_manager_name docs.

comment:4 by Carlton Gibson <carlton.gibson@…>, 5 years ago

In c5cbb797:

[2.2.x] Fixed #30688 -- Clarified base_manager_name docs.

Backport of 514efa3129792ec2abb2444f3e7aeb3f21a38386 from master

Note: See TracTickets for help on using tickets.
Back to Top