Hey, I wonder about the solution to the question that is being posed mid video in the titular part of the ultimate django course. Basically, we have to select all products that are ordered, and sort them by name. To achieve that, Mosh does some pretty intricate mechanisms with selecting product IDs, then passing these IDs as a filter etc.
But I wonder, why can’t we just do:
query_set = OrderItem.objects.values(‘product__title’).distinct().order_by(“product__title”)
Not only does it work, but also it removes duplicates in the actual end result, whereas Mosh’s solution contains duplicates (6:02) in the vid. Am I missing something?