Write code to get: •Customers with their last order ID
what I expected:
queryset = Customer.objects.annotate(
last_order_id = ('order__id').order_by('order__placed_at')
)
which solution is
in database, the last order by user 1 is 321, the solution gives 931
321,2021-03-17 00:00:00.000000,F,1
403,2021-02-25 00:00:00.000000,P,1
540,2020-08-25 00:00:00.000000,F,1
544,2020-10-31 00:00:00.000000,F,1
931,2020-12-19 00:00:00.000000,C,1