我有一個django模型查詢,需要從特定的表中獲取不同的行,但由於某種原因,它不提取它。Django模型不同的子句
讓我知道你輸入
查詢
Volunteercontacts.objects.order_by('name')- gives me the expected answer ie;ordering by name
Volunteercontacts.objects.order_by('name').distinct('name')- does not eliminate the duplicate
https://docs.djangoproject.com/en/dev/ref/models/querysets/ #distinct和http://stackoverflow.com/questions/453477/queryset-api-distinct-does-not-work/460702#460702 – dm03514
向我們顯示輸出。另外,請嘗試顛倒方法調用的順序。 – Marcin