1
Name the annotated value and use it in filter.
orders.values('sales_rep__username', 'sales_rep__email').annotate(order_count=Count('sales_rep')).filter(order_count__gt=100)
Source:stackexchange.com
1
Name the annotated value and use it in filter.
orders.values('sales_rep__username', 'sales_rep__email').annotate(order_count=Count('sales_rep')).filter(order_count__gt=100)