#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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.8be6412c403da8edc92756653dde9e0a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.