[Django] #28233: Improve the "price_per_page" example in the Documentation on Aggregation

18 views
Skip to first unread message

Django

unread,
May 23, 2017, 10:37:00 AM5/23/17
to django-...@googlegroups.com
#28233: Improve the "price_per_page" example in the Documentation on Aggregation
-------------------------------------+-------------------------------------
Reporter: liushigit | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: | Version: 1.11
Documentation | Keywords: Documentation,
Severity: Normal | Aggregation, Code Example
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
This example is not very clear. There has been some talk about it:
https://groups.google.com/forum/#!topic/django-users/CqEGJCI5aNs

{{{
# Cost per page
>>> from django.db.models import F, FloatField, Sum
>>> Book.objects.all().aggregate(
... price_per_page=Sum(F('price')/F('pages'),
output_field=FloatField()))
{'price_per_page': 0.4470664529184653}
}}}

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

Django

unread,
May 24, 2017, 9:20:26 AM5/24/17
to django-...@googlegroups.com
#28233: Improve the "price_per_page" example in the aggregation documentation
-------------------------------------+-------------------------------------
Reporter: Shi Liu | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: Documentation, | Triage Stage: Accepted
Aggregation, Code Example |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


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

Django

unread,
May 25, 2017, 4:51:00 AM5/25/17
to django-...@googlegroups.com
#28233: Improve the "price_per_page" example in the aggregation documentation
-------------------------------------+-------------------------------------
Reporter: Shi Liu | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: Documentation, | Triage Stage: Accepted
Aggregation, Code Example |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Windson yang):

Is use 'Sum' function here just for syntax correct?

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

Django

unread,
May 28, 2017, 1:54:03 PM5/28/17
to django-...@googlegroups.com
#28233: Improve the "price_per_page" example in the aggregation documentation
-------------------------------------+-------------------------------------
Reporter: Shi Liu | Owner: Rajesh
Type: | Veeranki
Cleanup/optimization | Status: assigned

Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: Documentation, | Triage Stage: Accepted
Aggregation, Code Example |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Rajesh Veeranki):

* owner: nobody => Rajesh Veeranki
* status: new => assigned
* has_patch: 0 => 1


Comment:

Submitted PR: https://github.com/django/django/pull/8567
Please let me know if it needs improvement.

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

Django

unread,
Jun 6, 2017, 4:44:37 PM6/6/17
to django-...@googlegroups.com
#28233: Improve the "price_per_page" example in the aggregation documentation
-------------------------------------+-------------------------------------
Reporter: Shi Liu | Owner: Rajesh
Type: | Veeranki
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: Documentation, | Triage Stage: Ready for
Aggregation, Code Example | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Accepted => Ready for checkin


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

Django

unread,
Jun 7, 2017, 9:43:55 AM6/7/17
to django-...@googlegroups.com
#28233: Improve the "price_per_page" example in the aggregation documentation
-------------------------------------+-------------------------------------
Reporter: Shi Liu | Owner: Rajesh
Type: | Veeranki
Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.11
Severity: Normal | Resolution: fixed

Keywords: Documentation, | Triage Stage: Ready for
Aggregation, Code Example | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"49b9c89d4094574117c9d5b7a696ce152e02553a" 49b9c89d]:
{{{
#!CommitTicketReference repository=""
revision="49b9c89d4094574117c9d5b7a696ce152e02553a"
Fixed #28233 -- Used a simpler example in the aggregation "cheat sheet"
docs.
}}}

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

Django

unread,
Jun 7, 2017, 9:44:04 AM6/7/17
to django-...@googlegroups.com
#28233: Improve the "price_per_page" example in the aggregation documentation
-------------------------------------+-------------------------------------
Reporter: Shi Liu | Owner: Rajesh
Type: | Veeranki
Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: Documentation, | Triage Stage: Ready for
Aggregation, Code Example | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"bc9c6fe7cb11fb0a59b39ca6f7661cb6013f513c" bc9c6fe]:
{{{
#!CommitTicketReference repository=""
revision="bc9c6fe7cb11fb0a59b39ca6f7661cb6013f513c"
[1.11.x] Fixed #28233 -- Used a simpler example in the aggregation "cheat
sheet" docs.

Backport of 49b9c89d4094574117c9d5b7a696ce152e02553a from master
}}}

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

Reply all
Reply to author
Forward
0 new messages