I am trying to display distinct or unique values from my column/field category
The function from views.py
:
def category(request, book_category):
latest_book_list = Books.objects.all().order_by('id')
return render_to_response('books/category.html', {'latest_book_list': latest_book_list})
I would like the line: latest_book_list = Books.objects.all().order_by('id')
To perform the mysql query:
mysql> select distinct category from books;
I have tried using the Books.objects.filter(category=book_category)
but it returns blank.
Any suggestions?