[Django] #20768: Create a reference of public Manager methods

27 views
Skip to first unread message

Django

unread,
Jul 18, 2013, 2:30:59 PM7/18/13
to django-...@googlegroups.com
#20768: Create a reference of public Manager methods
-----------------------------------------+------------------------
Reporter: ramiro | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
In the "Natural keys" documentation, an example of a custom manager's
`get_by_natural_key()` method calls `self.get()`
(https://docs.djangoproject.com/en/dev/topics/serialization
/#deserialization-of-natural-keys) but we don't document which the
available methods are.

We should expand the reference-type documentation of manager, even if only
to note some of them simply proxy to the respective !QuerySet methods:

https://github.com/django/django/blob/master/django/db/models/manager.py#L111

--
Ticket URL: <https://code.djangoproject.com/ticket/20768>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 19, 2013, 7:25:11 AM7/19/13
to django-...@googlegroups.com
#20768: Create a reference of public Manager methods
-------------------------------+------------------------------------

Reporter: ramiro | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timo):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/20768#comment:1>

Django

unread,
Jul 26, 2013, 7:16:50 AM7/26/13
to django-...@googlegroups.com
#20768: Create a reference of public Manager methods
-------------------------------+------------------------------------

Reporter: ramiro | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by ramiro):

In master there are news in this front #20625 and
[31fadc120213284da76801cc7bc56e9f32d7281b]

--
Ticket URL: <https://code.djangoproject.com/ticket/20768#comment:2>

Django

unread,
Jul 27, 2013, 4:34:19 AM7/27/13
to django-...@googlegroups.com
#20768: Create a reference of public Manager methods
-------------------------------+------------------------------------

Reporter: ramiro | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by loic84):

IMO `ref/models/managers.txt` should take over a fair chunk from the topic
guide `topics/db/managers.txt`.

The reference would include the stock `Manager` methods and attributes and
everything one needs to know about '''using''' managers (either the stock
`Manager` or subclasses like `CurrentSiteManager`). I suggest the
following:

- A section about `QuerySet` methods. I'm not sure if we should list them
all or just mention that all `QuerySet` public methods but `delete()` are
available from `Manager`.
- Reference the `from_queryset()`, `get_queryset()`, `raw()` methods and
the `model`, `db`, `use_for_related_fields` attributes.
- Get "Manager names" from the topic guide.
- Split "Modifying initial Manager QuerySets" from the topic guide into
two parts, one that goes within the `get_queryset()` definition and the
other one into a new section "Using multiple managers on the same model".
- Get "Custom managers and model inheritance" from the topic guide.

The topic guide would then stick to the ins and outs of creating a custom
Manager:

- "Calling custom QuerySet methods from the Manager"
- "Creating Manager with QuerySet methods" (linked from
`Manager.from_queryset` and `QuerySet.as_manager`)
- A new section about creating a `Manager` by compositing `QuerySets` like
the example in
https://github.com/django/django/pull/1328#issuecomment-21439470
- "Implementation concerns"
- "Controlling automatic Manager types" (Linked from
`Manager.use_for_related_fields`)
- "Writing correct Managers for use in automatic Manager instances"
(Linked from `Manager.use_for_related_fields`)

While we are at it, we should remove the Male/Female distinction from the
examples.

Feedback welcome.

--
Ticket URL: <https://code.djangoproject.com/ticket/20768#comment:3>

Django

unread,
Jul 29, 2013, 8:20:50 AM7/29/13
to django-...@googlegroups.com
#20768: Create a reference of public Manager methods
-------------------------------+------------------------------------

Reporter: ramiro | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by loic84):

While addressing this, we should account for @ramiro's
[https://github.com/django/django/commit/31fadc120213284da76801cc7bc56e9f32d7281b#commitcomment-3725813
on the PR]. Probably by removing the custom `__init__` altogether.

--
Ticket URL: <https://code.djangoproject.com/ticket/20768#comment:4>

Django

unread,
Mar 12, 2024, 6:42:05 AM3/12/24
to django-...@googlegroups.com
#20768: Create a reference of public Manager methods
--------------------------------+------------------------------------
Reporter: Ramiro Morales | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/20768#comment:5>

Django

unread,
Oct 18, 2024, 6:29:17 AM10/18/24
to django-...@googlegroups.com
#20768: Create a reference of public Manager methods
--------------------------------+------------------------------------
Reporter: Ramiro Morales | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by Clifford Gama):

* cc: Clifford Gama (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/20768#comment:6>

Django

unread,
Feb 7, 2025, 5:54:46 AM2/7/25
to django-...@googlegroups.com
#20768: Create a reference of public Manager methods
--------------------------------+-----------------------------------------
Reporter: Ramiro Morales | Owner: Clifford Gama
Type: New feature | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+-----------------------------------------
Changes (by Clifford Gama):

* owner: nobody => Clifford Gama
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/20768#comment:7>
Reply all
Reply to author
Forward
0 new messages