I've tried various permuations of filters and approaches in attempting to get unique/distinct results on a django query with postgres data to no avail. Using distinct() has no effect on queries in the following examples...
qset = (Q(title__icontains='MOBY DICK')) results1 = books.objects.filter(qset).distinct() I've also tried the following where ItemNo is an integer. X = books.objects.order_by('ItemNo').filter(qset).distinct('ItemNo') Y = X.order_by('ItemNo').distinct('ItemNo') .distinct() in the above instances has no effect, i get a list of books with the same author, title, itemno. Even though they are different editions and reflected in the data by separate records its not possible to simply get a preliminary distinct list. I'm curious if there is another means of getting django data query to return a distinct list, or if somehow I'm using distinct incorrectly? Also is there anyway to see the verbose/verbatum SQL these django queries are generating? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---