I have submitted a ticket: https://code.djangoproject.com/ticket/28233
在 2017年2月9日星期四 UTC+8上午7:24:24,Tim Graham写道:
>
> Please submit a pull request to fix the documentation if you can.
>
> There's an open ticket for a way to get the SQL for a terminal queryset
> method: https://code.djangoproject
Hi, have you submitted an issue or pull request for that? If not, I can
help with that.
在 2017年2月9日星期四 UTC+8上午6:09:25,Viktor Bale写道:
>
> Ok, you spurred me on to actually try it out. And the answer is
> interpretation (i) is correct. Which means the example in the cheat sheet
> is somewhat misl
Please submit a pull request to fix the documentation if you can.
There's an open ticket for a way to get the SQL for a terminal queryset
method: https://code.djangoproject.com/ticket/18631
On Wednesday, February 8, 2017 at 5:09:25 PM UTC-5, Viktor Bale wrote:
>
> Ok, you spurred me on to actual
Ok, you spurred me on to actually try it out. And the answer is
interpretation (i) is correct. Which means the example in the cheat sheet
is somewhat misleading, since it does't calculate price per page, rather
the sum of prices per page for individual books.
BTW, while playing with that little
As for me, this statement from that page applies, "It’s difficult to intuit
how the ORM will translate complex querysets into SQL queries so when in
doubt, inspect the SQL with str(queryset.query) and write plenty of tests."
I'm not good at figuring out at a glance what an aggregation query will
Hi all
No takers, eh? Does this means it also confuses other more experienced
people, or that it's a silly question? If the aggration function was Avg
instead of Sum, then it would make perfect sense (the average price per
page over all books)... but it doesn't, so it doesn't :-)
Thanks
On Mo
This is confusing me.
In the topic guide on Aggregation
(https://docs.djangoproject.com/en/1.10/topics/db/aggregation/#cheat-sheet),
there is an example in the cheat sheet as follows:
# Cost per page>>> from django.db.models import F, FloatField, Sum>>>
Book.objects.all().aggregate(...pri
On Jun 4, 10:20 pm, "P. Kaminski" wrote:
> Hello,
> I'm studying the Django page on aggregation
> In the section 'Joins and aggregates' there's an example of how to
> create an annotation for each Store with book price ranges. But what
> if I want to do the opposite, i.e. for each available Book,
Hello,
I'm studying the Django page on aggregation
http://docs.djangoproject.com/en/dev/topics/db/aggregation/
In the section 'Joins and aggregates' there's an example of how to
create an annotation for each Store with book price ranges. But what
if I want to do the opposite, i.e. for each availabl
I have a list of categorized posts, and I want to return the last five
posts in each category.
Within my view, I have
categories = Post.objects.published().values('category')
which gets me a list of categories that are not empty, but I am not sure
how to go from there to having querysets that in
10 matches
Mail list logo