Thank you Simon, that worked. -- John
On Sun, Jul 21, 2019 at 8:55 PM Simon Charette wrote:
> Assuming you have a model definition `Salesperson` you could use
>
> Salesperson.object.annotate(
> sales_amount=Sum('sales__sales_amount'),
> )
>
> But given you mentioned 'salesperson' is a text f
Assuming you have a model definition `Salesperson` you could use
Salesperson.object.annotate(
sales_amount=Sum('sales__sales_amount'),
)
But given you mentioned 'salesperson' is a text field you can do
persons = Sales.objects.values('salesperson').annotate(
sum_sales_amount=Sum('sales_am
Hello,
Python version: Python 3.7.2
Django version: 2.2.3
I want to combine distinct and annotate(Sum(...)), and get the following
error:
NotImplementedError: annotate() + distinct(fields) is not implemented.
To describe: I have a bunch of sales entries like:
'John', 100
'Sam', 50
'John', 200
(t
3 matches
Mail list logo