Timeline for Django group by after annotate does not work
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 12 at 8:37 | comment | added | User Dev | Yes, we must filter to sum only orders that have only one ProductToOrder with qty = 1 | |
Apr 12 at 7:43 | comment | added | willeM_ Van Onsem |
@UserDev: and thus only work with Order s for that org_slug with exactly one OrderToProduct with qty=1 ?
|
|
Apr 12 at 7:42 | comment | added | User Dev | I need to aggregate per org_slug. For example, if I have 1000 orders with 2 different org_slugs, the result must be the list with 2 elements. Your solution will return 1 element. My solution will return 1000 elements, it just sum to all orders and doesn't apply group by .values('org_slug'). | |
Apr 12 at 6:17 | comment | added | willeM_ Van Onsem |
@UserDev: so you aggregate per org_slug , or per Order ?
|
|
Apr 12 at 4:38 | comment | added | User Dev | Thank you for your answer. There is one problem with this solution, it will work only for one particular org_slug, and if we have hundred org_slugs, we need to make hundred requests to database in loop to extract all of them. It will be really slow. | |
Apr 11 at 18:41 | history | answered | willeM_ Van Onsem | CC BY-SA 4.0 |