django model query add annotation field to show duplicate count

from django.db.models import OuterRef, Subquery, Count, Min

subquery = Product.objects.filter(bc_sku=OuterRef('bc_sku')).values('bc_sku')
                          .annotate(dup_count=Count('*'), min_price=Min('product_price'))
Product.objects.filter(product_type='good')
               .annotate(dup_count=Subquery(subquery.values('dup_count')), 
                         min_price=Subquery(subquery.values('min_price')))

Here is what the above code is Doing:
1. We’re creating a subquery that will return the number of duplicates and the minimum price for each product.
2. We’re annotating the Product model with the number of duplicates and the minimum price.