In Django, what’s the difference between the following two:

Article.objects.values_list('comment_id', flat=True).distinct()

vs

Article.objects.values('comment_id').distinct()

My goal is to get a list of unique comment ids under each Article. I’ve read the documentation (and in fact have used both approaches). The results overtly seem similar.

4 Answers
4

Leave a Reply

Your email address will not be published. Required fields are marked *